102 if (!$this->cx) $this->cx = $this->
width / 2;
103 if (!$this->cy) $this->cy = $this->
height / 2;
104 if (!$this->radius) $this->radius = min(
$width,
$height) * .4;
109 $this->containerWidth =
$width;
110 $this->containerHeight =
$height;
126 $this->labelSize =
$size;
131 $this->strokeWidth = $s;
136 $this->fontFamily = $font;
141 $this->legend = $show;
148 $this->percentages = $show;
149 $this->percentagesSize =
$size;
150 $this->percentagesDistance = $distance;
158 $this->titleSize =
$size;
164 $values = implode(
", ", $this->values);
165 $labels =
"'".implode(
"', '", $this->labels) .
"'";
166 $animate = $this->animate ?
"true" :
"false";
168 $emboss = $this->
emboss ?
"true" :
"false";
169 $legend = $this->legend ?
"true" :
"false";
171 $download = $this->enableDownload ?
"true" :
"false";
175 if (is_array($this->preselected))
177 $preselected =
",\n\t\tpreselected: [".implode(
",", $this->preselected).
"]";
189 $titleOptions =
"\n\t\ttitle: '".jsSafe($this->
title).
"',\n\t\ttitlex: {$this->titleX},\n\t\ttitley: {$this->titleY},\n\t\ttitleSize: {$this->titleSize},\n";
192 $script .= <<<ENDSCRIPT
193 <script type=
"text/javascript">
194 window.addEvent(
'domready',
function ()
196 var {$this->
id} =
new PieChart(
'{$this->id}',
202 radius: {$this->radius},
203 palette:
'{$this->palette}',
204 labelSize: {$this->labelSize},
205 fontFamily:
'{$this->fontFamily}',
206 strokeWidth: {$this->strokeWidth},
211 legendX: {$this->legendX},
212 legendY: {$this->legendY},
213 legendSwatchSize: {$this->legendSwatchSize},
214 legendLineHeight: {$this->legendLineHeight},
216 percentagesSize: {$this->percentagesSize},
217 onSectorOver: {$this->onSectorOver},
218 onSectorOut: {$this->onSectorOut},
219 onSectorClick: {$this->onSectorClick},
220 onLegendOver: {$this->onLegendOver},
221 onLegendOut: {$this->onLegendOut},
222 onLegendClick: {$this->onLegendClick},
223 onDrawChart: {$this->onDrawChart},
224 onDrawChartComplete: {$this->onDrawChartComplete},
225 onDrawLegend: {$this->onDrawLegend},
226 onDrawLegendComplete: {$this->onDrawLegendComplete},
227 onSelectionChanged: {$this->onSelectionChanged},
228 enableDownload: {$download},
229 canvasBackground:
'{$this->canvasBackground}',
233 {$this->
id}.values = [
$values ];
234 {$this->
id}.labels = [
$labels ];
243 $dimensions =
"width: 100%; height: auto";
245 else if ($this->fixedSize)
247 $dimensions =
"width: {$containerWidth}; height: {$containerHeight};";
254 echo
"<div id='{$this->id}' style='$dimensions'></div>";
static using()
Import the datamodels, views and manifest for the specified component(s).
showPercentages($show, $size=16, $distance=0.75)
PieChart($id, $width=300, $height=300, $values=null, $labels=null, $palette="standard")
setTitle($title, $x=300, $y=25, $size=14)
setContainerSize($width, $height="0")
showLegend($show, $x=0, $y=0)