2 /* vim: set expandtab sw=4 ts=4 sts=4: */
10 require_once 'pma_pchart_single.php';
13 * implements single radar chart
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();
26 * Get the largest value from the data and normalize all the other values.
28 private function normalizeValues()
31 $keys = array_keys($this->data
);
33 $maxValue = max($this->data
[$valueKey]);
35 foreach ($this->data
[$valueKey] as &$value) {
36 $value = $value / $maxValue * 10;
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
),
51 $this->chart
->drawGraphAreaGradient(
52 $this->getGraphAreaGradientColor(RED
),
53 $this->getGraphAreaGradientColor(GREEN
),
54 $this->getGraphAreaGradientColor(BLUE
),
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;
78 // the least ammount that radar is away from the graph area side.
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);