forked from pacbard/gChartPhp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgConcentricPieChart.php
34 lines (34 loc) · 947 Bytes
/
gConcentricPieChart.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace gchart;
/**
* @brief Concentric Pie Chart
*/
class gConcentricPieChart extends gPieChart
{
function __construct($width = 350, $height = 200)
{
$this->setProperty('cht', 'pc');
$this->setDimensions($width, $height);
}
/**
* @brief Returns the applicable labels for the chart.
*
* This function counts recursively the numeber of values in the $values array.
* @return Array Applicable labels
*/
public function getApplicableLabels($labels)
{
return array_splice($labels, 0, count($this->values, COUNT_RECURSIVE));
}
/**
* @brief Adds the legend for Concentric Pie Charts
*
* Run an instance of this function for each data set.
*
* @param $labels Array
*/
public function addLegend($labels)
{
$this->setProperty('chdl', urlencode($this->encodeData($this->getApplicableLabels($labels),"|")), true);
}
}