Translation update done using Pootle.
[phpmyadmin-themes.git] / libraries / chart / pma_pchart_single_radar.php
blobdbe2b2e18f182308034fe8784816acbacc7c3241
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_single.php';
12 /**
13 * implements single radar chart
14 * @package phpMyAdmin
16 class PMA_pChart_single_radar extends PMA_pChart_single
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[0];
33 $maxValue = max($this->data[$valueKey]);
35 foreach ($this->data[$valueKey] as &$value) {
36 $value = $value / $maxValue * 10;
40 /**
41 * graph area for the radar chart does not include grid lines
43 protected function drawGraphArea()
45 $this->chart->drawGraphArea(
46 $this->getGraphAreaColor(RED),
47 $this->getGraphAreaColor(GREEN),
48 $this->getGraphAreaColor(BLUE),
49 FALSE
51 $this->chart->drawGraphAreaGradient(
52 $this->getGraphAreaGradientColor(RED),
53 $this->getGraphAreaGradientColor(GREEN),
54 $this->getGraphAreaGradientColor(BLUE),
59 /**
60 * draws the radar chart
62 protected function drawChart()
64 // when drawing radar graph we can specify the border from the top of
65 // graph area. We want border to be dynamic, so that either the top
66 // or the side of the radar is some distance away from the top or the
67 // side of the graph area.
68 $areaWidth = $this->chart->GArea_X2 - $this->chart->GArea_X1;
69 $areaHeight = $this->chart->GArea_Y2 - $this->chart->GArea_Y1;
71 if ($areaHeight > $areaWidth) {
72 $borderOffset = ($areaHeight - $areaWidth) / 2;
74 else {
75 $borderOffset = 0;
78 // the least ammount that radar is away from the graph area side.
79 $borderOffset += 40;
81 $this->chart->drawRadarAxis($this->dataSet->GetData(), $this->dataSet->GetDataDescription(),
82 TRUE, $borderOffset, 120, 120, 120, 230, 230, 230, -1, 2);
83 $this->chart->drawFilledRadar($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), 50, $borderOffset);