Translation update done using Pootle.
[phpmyadmin/sankalp_k.git] / libraries / chart / pma_pchart_pie.php
blobcc82df5c5734d9b66e52dacb9b5557eeb31243fe
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @package phpMyAdmin
5 */
7 /**
9 */
10 require_once 'pma_pchart_multi.php';
12 /**
13 * implements pie chart
14 * @package phpMyAdmin
16 class PMA_pChart_Pie extends PMA_pChart_multi
18 public function __construct($data, $options = null)
20 // limit data size, no more than 18 pie slices
21 $data = array_slice($data, 0, 18, true);
22 parent::__construct($data, $options);
24 $this->setAreaMargins(array(20, 10, 20, 20));
27 /**
28 * prepare data set for the pie chart
30 protected function prepareDataSet()
32 // Dataset definition
33 $this->dataSet->AddPoint(array_values($this->data), "Values");
34 $this->dataSet->AddPoint(array_keys($this->data), "Keys");
35 $this->dataSet->AddAllSeries();
36 $this->dataSet->SetAbsciseLabelSerie("Keys");
39 /**
40 * graph area for the pie chart does not include grid lines
42 protected function drawGraphArea()
44 $this->chart->drawGraphArea(
45 $this->getGraphAreaColor(RED),
46 $this->getGraphAreaColor(GREEN),
47 $this->getGraphAreaColor(BLUE),
48 FALSE
50 $this->chart->drawGraphAreaGradient(
51 $this->getGraphAreaGradientColor(RED),
52 $this->getGraphAreaGradientColor(GREEN),
53 $this->getGraphAreaGradientColor(BLUE),
58 /**
59 * draw the pie chart
61 protected function drawChart()
63 parent::drawChart();
65 // draw pie chart in the middle of graph area
66 $middleX = ($this->chart->GArea_X1 + $this->chart->GArea_X2) / 2;
67 $middleY = ($this->chart->GArea_Y1 + $this->chart->GArea_Y2) / 2;
69 $this->chart->drawPieGraph(
70 $this->dataSet->GetData(),
71 $this->dataSet->GetDataDescription(),
72 $middleX,
73 // pie graph is skewed. Upper part is shorter than the
74 // lower part. This is why we set an offset to the
75 // Y middle coordiantes.
76 $middleY - 15,
77 120, PIE_PERCENTAGE, FALSE, 60, 30, 10, 1);
80 /**
81 * draw legend for the pie chart
83 protected function drawLegend()
85 $this->chart->drawPieLegend(
86 $this->getWidth() - $this->getLegendMargin(RIGHT) - $this->getLegendBoxWidth(),
87 $this->getLabelHeight() + $this->getLegendMargin(TOP),
88 $this->dataSet->GetData(),
89 $this->dataSet->GetDataDescription(),
90 250, 250, 250);
93 protected function getLegendBoxWidth()
95 $legendSize = $this->chart->getPieLegendBoxSize($this->dataSet->GetData());
96 return $legendSize[0];