2 /* vim: set expandtab sw=4 ts=4 sts=4: */
10 require_once 'pma_pchart_multi.php';
13 * implements multi radar chart
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();
26 * Get the largest value from the data and normalize all the other values.
28 private function normalizeValues()
31 $keys = array_keys($this->data
);
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;
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
),
60 $this->chart
->drawGraphAreaGradient(
61 $this->getGraphAreaGradientColor(RED
),
62 $this->getGraphAreaGradientColor(GREEN
),
63 $this->getGraphAreaGradientColor(BLUE
),
69 * draw multi radar chart
71 protected function 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;
89 // the least ammount that radar is away from the graph area side.
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);