5 # Part of the Collection Workflow Integration System (CWIS) 6 # Copyright 2017 Edward Almasy and Internet Scout Research Group 7 # http://scout.wisc.edu/cwis/ 15 # ---- PUBLIC INTERFACE -------------------------------------------------- 32 $this->Precision = $Prec;
45 if (!in_array($LabelType,
46 [static::LABEL_PERCENT, static::LABEL_NAME, static::LABEL_RAW]))
48 throw new Exception(
"Unsupported slice label type: ".$LabelType);
54 # label type constants 59 # ---- PRIVATE INTERFACE -------------------------------------------------- 66 $this->Chart[
"data"][
"columns"] = [];
67 foreach ($this->Data as $Label => $Value)
72 $this->LabelLUT[$MyLabel] = $Label;
79 $this->Chart[
"data"][
"columns"][]= [$MyLabel, $Value];
88 "format" =>
"label_format_fn",
102 function tooltip_value_fn(value, ratio,
id, index) {
103 return value +
" ("+(
new Number(100*ratio)).toFixed(<?= $this->Precision ?>)+
"%)";
106 function label_format_fn(value, ratio,
id, index) {
108 return (
new Number(100*ratio)).toFixed(<?= $this->Precision ?>)+
"%";
119 private $SliceLabelType = self::LABEL_PERCENT;
120 private $Precision = 1;
PrepareData()
Prepare data for display.
Base class for generating and displaying a chart.
LegendLabels($LegendLabels)
Set shortened labels to be used in the legend of the chart.
SliceLabelType($LabelType)
Set the style for slice labels.
__construct($Data)
Class constructor.
AddToChart($Data)
Merge an array of settings into $this->Chart.
PercentPrecision($Prec)
Set the precision used to display percentages.
Class for generating and displaying a pie chart.
DeclareHelperFunctions()
Output javascript that declares helper functions used to display the chart.