CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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:
[legend]
Collaboration diagram for PieChart:
[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...
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...
| Colors ($NewValue=NULL)
| 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"
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
Protected Attributes inherited from Chart_Base
| $Data = []
| $LegendPosition = self::LEGEND_BOTTOM
| $Colors = NULL
| $LegendLabels = []
| $Height = 600
| $Width = 600
| $LabelLUT = []
| $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 | $Data | Data for chart, with labels for the index.

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 98 of file PieChart.php.

References PHP, and SliceLabelType().

PieChart::PercentPrecision | ( |  | $Prec | ) |

Set the precision used to display percentages.

Parameters

  int | $Prec | Number 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 64 of file PieChart.php.

References Chart_Base\AddToChart(), and Chart_Base\LegendLabels().

PieChart::SliceLabelType | ( |  | $LabelType | ) |

Set the style for slice labels.

Parameters

  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.

Exceptions

  Exception | If 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:

## Member Data Documentation

const PieChart::LABEL_NAME = "Name"

Definition at line 57 of file PieChart.php.

const PieChart::LABEL_PERCENT = "Percent"

Definition at line 55 of file PieChart.php.

const PieChart::LABEL_RAW = "Raw"

Definition at line 56 of file PieChart.php.

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

- interface/default/objects/PieChart.php