Translation update done using Pootle.
[phpmyadmin/sankalp_k.git] / libraries / chart / pma_pchart_multi_radar.php
blobe4acae2f7b1e0d902ecdf8b6807345dff11a075e
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @package phpMyAdmin
5 */
7 /**
8 *
9 */
10 require_once 'pma_pchart_multi.php';
12 /**
13 * implements multi radar chart
14 * @package phpMyAdmin
16 class PMA_pChart_multi_radar extends PMA_pChart_multi
18 public function __construct($data, $options = null)
20 parent::__construct($data, $options);
22 $this->normalizeValues();
25 /**
26 * Get the largest value from the data and normalize all the other values.
28 private function normalizeValues()
30 $maxValue = 0;
31 $keys = array_keys($this->data);
32 $valueKey = $keys[1];
34 // get the max value
35 foreach ($this->data[$valueKey] as $values) {
36 if (max($values) > $maxValue) {
37 $maxValue = max($values);
41 // normalize all the values according to the max value
42 foreach ($this->data[$valueKey] as &$values) {
43 foreach ($values as &$value) {
44 $value = $value / $maxValue * 10;
49 /**
50 * graph area for the radar chart does not include grid lines
52 protected function drawGraphArea()
54 $this->chart->drawGraphArea(
55 $this->getGraphAreaColor(RED),
56 $this->getGraphAreaColor(GREEN),
57 $this->getGraphAreaColor(BLUE),
58 FALSE
60 $this->chart->drawGraphAreaGradient(
61 $this->getGraphAreaGradientColor(RED),
62 $this->getGraphAreaGradientColor(GREEN),
63 $this->getGraphAreaGradientColor(BLUE),
68 /**
69 * draw multi radar chart
71 protected function drawChart()
73 parent::drawChart();
75 // when drawing radar graph we can specify the border from the top of
76 // graph area. We want border to be dynamic, so that either the top
77 // or the side of the radar is some distance away from the top or the
78 // side of the graph area.
79 $areaWidth = $this->chart->GArea_X2 - $this->chart->GArea_X1;
80 $areaHeight = $this->chart->GArea_Y2 - $this->chart->GArea_Y1;
82 if ($areaHeight > $areaWidth) {
83 $borderOffset = ($areaHeight - $areaWidth) / 2;
85 else {
86 $borderOffset = 0;
89 // the least ammount that radar is away from the graph area side.
90 $borderOffset += 40;
92 // Draw the radar chart
93 $this->chart->drawRadarAxis($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), TRUE, $borderOffset,
94 120, 120, 120, 230, 230, 230, -1, 2);
95 $this->chart->drawFilledRadar($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), 50, $borderOffset);