CWIS Developer Documentation
|
Class for generating and displaying a pie chart. More...
Public Member Functions | |
__construct ($Data) | |
Class constructor. More... | |
PercentPrecision ($Prec) | |
Set the precision used to display percentages. More... | |
SliceLabelType ($LabelType) | |
Set the style for slice labels. More... | |
TooltipType ($LabelType) | |
Set the style for values shown in the tooltip. More... | |
![]() | |
LegendPosition ($Position) | |
Set legend position. More... | |
LegendLabels ($LegendLabels) | |
Set shortened labels to be used in the legend of the chart. More... | |
Labels ($NewValue=NULL) | |
Get/set chart element labels (pie slices, bars, etc). More... | |
Colors ($NewValue=NULL) | |
Get/set color palette. More... | |
Height ($NewValue) | |
Get/Set height of the chart including the legend. More... | |
Width ($NewValue) | |
Get/Set width of the chart including the legend. More... | |
Display ($ContainerId) | |
Display a chart. More... | |
Public Attributes | |
const | LABEL_PERCENT = "Percent" |
const | LABEL_RAW = "Raw" |
const | LABEL_NAME = "Name" |
const | TOOLTIP_VALUE = "Value" |
const | TOOLTIP_PERCENT = "Percent" |
const | TOOLTIP_BOTH = "Both" |
![]() | |
const | LEGEND_BOTTOM = "bottom" |
const | LEGEND_RIGHT = "right" |
const | LEGEND_INSET = "inset" |
const | LEGEND_NONE = "none" |
Protected Member Functions | |
PrepareData () | |
Prepare data for display. More... | |
DeclareHelperFunctions () | |
Output javascript that declares helper functions used to display the chart. More... | |
![]() | |
PrepareData () | |
Massage data provided by the user into an appropriate format for plotting and do any necessary tweaks to $this->Chart. More... | |
DeclareStateVariables () | |
Output var declarations for any js state variables needed in this chart's display helper functions. More... | |
DeclareHelperFunctions () | |
Output function definitions for any needed javascript display helper functions. More... | |
GenerateRgbColorString ($DataIndex) | |
Get RGB hex color when no color supplied. More... | |
AddToChart ($Data) | |
Merge an array of settings into $this->Chart. More... | |
AddToArray (&$Tgt, $Data) | |
Merge elements from a source array into a dest array. More... | |
Additional Inherited Members | |
![]() | |
static | PrepForDisplayingCachedVersion () |
Set up the chart environment so that cached HTML from a previous Display() call will function properly. More... | |
![]() | |
static | RequireNeededFiles () |
Include necessary JS/CSS for chart generation. More... | |
![]() | |
$Data = [] | |
$LegendPosition = self::LEGEND_BOTTOM | |
$Colors = NULL | |
$Labels = [] | |
$LegendLabels = [] | |
$Height = 600 | |
$Width = 600 | |
$TooltipLabels = [] | |
$Chart = NULL | |
Class for generating and displaying a pie chart.
Definition at line 13 of file PieChart.php.
PieChart::__construct | ( | $Data | ) |
Class constructor.
array | $Data | Data for chart. |
Definition at line 21 of file PieChart.php.
References Chart_Base\$Data.
|
protected |
Output javascript that declares helper functions used to display the chart.
Definition at line 134 of file PieChart.php.
References PHP, and SliceLabelType().
PieChart::PercentPrecision | ( | $Prec | ) |
Set the precision used to display percentages.
int | $Prec | Number of digits to display after the decimal. |
Definition at line 30 of file PieChart.php.
|
protected |
Prepare data for display.
Definition at line 88 of file PieChart.php.
References Chart_Base\AddToChart(), Chart_Base\Labels(), and Chart_Base\LegendLabels().
PieChart::SliceLabelType | ( | $LabelType | ) |
Set the style for slice labels.
string | $LabelType | Label type as a PieChart::LABEL_ constant. LABEL_PERCENT will display percentages, LABEL_NAME will display slice names, and LABEL_RAW will display the raw data. |
Exception | If an invalid slice label type is supplied. |
Definition at line 43 of file PieChart.php.
Referenced by DeclareHelperFunctions().
PieChart::TooltipType | ( | $LabelType | ) |
Set the style for values shown in the tooltip.
string | $LabelType | Label type as a PieChart::TOOLTIP_ constant. TOOLTIP_PERCENT will display percentages, TOOLTIP_VALUE will display raw values, and TOOLTIP_BOTH shows both. |
Exception | If an invalid tooltip label type is supplied. |
Definition at line 61 of file PieChart.php.
const PieChart::LABEL_NAME = "Name" |
Definition at line 76 of file PieChart.php.
const PieChart::LABEL_PERCENT = "Percent" |
Definition at line 74 of file PieChart.php.
const PieChart::LABEL_RAW = "Raw" |
Definition at line 75 of file PieChart.php.
const PieChart::TOOLTIP_BOTH = "Both" |
Definition at line 81 of file PieChart.php.
const PieChart::TOOLTIP_PERCENT = "Percent" |
Definition at line 80 of file PieChart.php.
const PieChart::TOOLTIP_VALUE = "Value" |
Definition at line 79 of file PieChart.php.