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
),
52 if($this->settings
['gradientIntensity']>0)
53 $this->chart
->drawGraphAreaGradient(
54 $this->getGraphAreaGradientColor(RED
),
55 $this->getGraphAreaGradientColor(GREEN
),
56 $this->getGraphAreaGradientColor(BLUE
),
57 $this->settings
['gradientIntensity']
60 $this->chart
->drawGraphArea(
61 $this->getGraphAreaGradientColor(RED
),
62 $this->getGraphAreaGradientColor(GREEN
),
63 $this->getGraphAreaGradientColor(BLUE
)
69 * draws the radar chart
71 protected function drawChart()
73 // when drawing radar graph we can specify the border from the top of
74 // graph area. We want border to be dynamic, so that either the top
75 // or the side of the radar is some distance away from the top or the
76 // side of the graph area.
77 $areaWidth = $this->chart
->GArea_X2
- $this->chart
->GArea_X1
;
78 $areaHeight = $this->chart
->GArea_Y2
- $this->chart
->GArea_Y1
;
80 if ($areaHeight > $areaWidth) {
81 $borderOffset = ($areaHeight - $areaWidth) / 2;
87 // the least ammount that radar is away from the graph area side.
90 $this->chart
->drawRadarAxis($this->dataSet
->GetData(), $this->dataSet
->GetDataDescription(),
91 TRUE, $borderOffset, 120, 120, 120, 230, 230, 230, -1, 2);
92 $this->chart
->drawFilledRadar($this->dataSet
->GetData(), $this->dataSet
->GetDataDescription(), 50, $borderOffset);