CWIS Developer Documentation
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
PieChart Class Reference

Class for generating and displaying a pie chart. More...

Inheritance diagram for PieChart:
Inheritance graph
[legend]
Collaboration diagram for PieChart:
Collaboration graph
[legend]

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...
 
- Public Member Functions inherited from Chart_Base
 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"
 
- Public Attributes inherited from Chart_Base
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...
 
- Protected Member Functions inherited from Chart_Base
 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 Public Member Functions inherited from Chart_Base
static PrepForDisplayingCachedVersion ()
 Set up the chart environment so that cached HTML from a previous Display() call will function properly. More...
 
- Static Protected Member Functions inherited from Chart_Base
static RequireNeededFiles ()
 Include necessary JS/CSS for chart generation. More...
 
- Protected Attributes inherited from Chart_Base
 $Data = []
 
 $LegendPosition = self::LEGEND_BOTTOM
 
 $Colors = NULL
 
 $Labels = []
 
 $LegendLabels = []
 
 $Height = 600
 
 $Width = 600
 
 $TooltipLabels = []
 
 $Chart = NULL
 

Detailed Description

Class for generating and displaying a pie chart.

Definition at line 13 of file PieChart.php.

Constructor & Destructor Documentation

PieChart::__construct (   $Data)

Class constructor.

Parameters
array$DataData for chart.

Definition at line 21 of file PieChart.php.

References Chart_Base\$Data.

Member Function Documentation

PieChart::DeclareHelperFunctions ( )
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.

Parameters
int$PrecNumber of digits to display after the decimal.

Definition at line 30 of file PieChart.php.

PieChart::PrepareData ( )
protected

Prepare data for display.

See also
ChartBase::PrepareData().

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.

Parameters
string$LabelTypeLabel 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.
Exceptions
ExceptionIf an invalid slice label type is supplied.

Definition at line 43 of file PieChart.php.

Referenced by DeclareHelperFunctions().

Here is the caller graph for this function:

PieChart::TooltipType (   $LabelType)

Set the style for values shown in the tooltip.

Parameters
string$LabelTypeLabel type as a PieChart::TOOLTIP_ constant. TOOLTIP_PERCENT will display percentages, TOOLTIP_VALUE will display raw values, and TOOLTIP_BOTH shows both.
Exceptions
ExceptionIf an invalid tooltip label type is supplied.

Definition at line 61 of file PieChart.php.

Member Data Documentation

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.


The documentation for this class was generated from the following file: