CMS  Version 3.9
RadarChart Class Reference

Public Member Functions

 __construct ($id, $width=300, $height=300, $labels=null, $palette="standard")
 
 setSize ($width, $height)
 
 setContainerSize ($width, $height="0")
 
 setCenter ($cx, $cy)
 
 setRadius ($r)
 
 setLabelSize ($size)
 
 setStrokeWidth ($s)
 
 setFontFamily ($font)
 
 setLabels ($labels)
 
 showLegend ($show, $x=0, $y=0)
 
 setPalette ($palette)
 
 addSeries ($series)
 
 draw ()
 

Public Attributes

 $width
 
 $height
 
 $containerWidth
 
 $containerHeight
 
 $cx
 
 $cy
 
 $max = 0
 
 $min = 0
 
 $radius
 
 $values
 
 $labels
 
 $palette
 
 $ticks = 10
 
 $labelSize = 12
 
 $strokeWidth = 1
 
 $animate = true
 
 $shadow = true
 
 $emboss = false
 
 $legend = false
 
 $legendX = 0
 
 $legendY = 0
 
 $titleSize = 20
 
 $legendSwatchSize = 20
 
 $legendLineHeight = 30
 
 $onLegendOver = "null"
 
 $onLegendOut = "null"
 
 $onLegendClick = "null"
 
 $scaleToFit = false
 
 $fontFamily = 'Arial, Helvetica'
 

Detailed Description

Definition at line 41 of file radar_chart.inc.

Constructor & Destructor Documentation

◆ __construct()

RadarChart::__construct (   $id,
  $width = 300,
  $height = 300,
  $labels = null,
  $palette = "standard" 
)

Definition at line 73 of file radar_chart.inc.

74  {
75  $this->id = $id;
76  $this->setSize($width, $height);
78  $this->labels = $labels;
79  $this->palette = $palette;
80  }
setSize($width, $height)
Definition: radar_chart.inc:82
setContainerSize($width, $height="0")
Definition: radar_chart.inc:91

Member Function Documentation

◆ addSeries()

RadarChart::addSeries (   $series)

Definition at line 139 of file radar_chart.inc.

140  {
141  $this->series[] = $series;
142  }
$series

◆ draw()

RadarChart::draw ( )

Definition at line 144 of file radar_chart.inc.

145  {
146  global $script;
147  $values = implode(", ", $this->values);
148  $labels = "'".implode("', '", $this->labels) . "'";
149  $animate = $this->animate ? "true" : "false";
150  $shadow = $this->shadow ? "true": "false";
151  $emboss = $this->emboss ? "true" : "false";
152  $legend = $this->legend ? "true" : "false";
153  $percentages = $this->showPercentages ? "true" : "false";
154  $download = $this->enableDownload ? "true" : "false";
155 
156  $containerWidth = is_numeric($this->containerWidth) ? $this->containerWidth . "px" : $this->containerWidth;
157  $containerHeight = is_numeric($this->containerHeight) ? $this->containerHeight . "px" : $this->containerHeight;
158 
159  $data = "";
160 
161  foreach($this->series as $s)
162  {
163  $data .= "\t{$this->id}.addSeries(".$s->toScript().");\n";
164  }
165 
166  $script .= <<<ENDSCRIPT
167 <script type="text/javascript">
168 window.addEvent('domready', function ()
169 {
170  var {$this->id} = new RadarChart('{$this->id}',
171  {
172  width: {$this->width},
173  height: {$this->height},
174  cx: {$this->cx},
175  cy: {$this->cy},
176  radius: {$this->radius},
177  palette: '{$this->palette}',
178  labelSize: {$this->labelSize},
179  fontFamily: '{$this->fontFamily}',
180  strokeWidth: {$this->strokeWidth},
181  ticks: {$this->ticks},
182  max: {$this->max},
183  min: {$this->min},
184  animate: {$animate},
185  shadow: {$shadow},
186  emboss: {$emboss},
187  legend: {$legend},
188  legendX: {$this->legendX},
189  legendY: {$this->legendY},
190  legendSwatchSize: {$this->legendSwatchSize},
191  legendLineHeight: {$this->legendLineHeight},
192  onLegendOver: {$this->onLegendOver},
193  onLegendOut: {$this->onLegendOut},
194  onLegendClick: {$this->onLegendClick},
195  title: '{$this->title}',
196  titleSize: {$this->titleSize},
197  enableDownload: {$download},
198  units: '{$this->units}'
199  });
200 
201  {$this->id}.labels = [ $labels ];
202 {$data}
203 
204  {$this->id}.draw();
205 });
206 </script>
207 ENDSCRIPT;
208 
209  if ($this->scaleToFit)
210  {
211  $dimensions = "width: 100%; height: auto";
212  }
213  else
214  {
215  $dimensions = "width: {$containerWidth}; height: {$containerHeight};";
216  }
217 
218  echo "<div id='{$this->id}' style='$dimensions'></div>";
219  }
$helpTree width
Definition: tree.inc:45
$bookmark title
$desc height
Definition: event_edit.inc:64
$dial scaleToFit
Definition: test_dial.inc:12
$dial shadow
Definition: test_dial.inc:11
$chart ticks
$chart max
$pie emboss
Definition: test_pie.inc:10

◆ setCenter()

RadarChart::setCenter (   $cx,
  $cy 
)

Definition at line 97 of file radar_chart.inc.

98  {
99  $this->cx = $cx;
100  $this->cy = $cy;
101  }

◆ setContainerSize()

RadarChart::setContainerSize (   $width,
  $height = "0" 
)

Definition at line 91 of file radar_chart.inc.

92  {
93  $this->containerWidth = $width;
94  $this->containerHeight = $height;
95  }

◆ setFontFamily()

RadarChart::setFontFamily (   $font)

Definition at line 118 of file radar_chart.inc.

119  {
120  $this->fontFamily = $font;
121  }

◆ setLabels()

RadarChart::setLabels (   $labels)

Definition at line 123 of file radar_chart.inc.

124  {
125  $this->labels = $labels;
126  }

◆ setLabelSize()

RadarChart::setLabelSize (   $size)

Definition at line 108 of file radar_chart.inc.

109  {
110  $this->labelSize = $size;
111  }
$size
Definition: download.inc:47

◆ setPalette()

RadarChart::setPalette (   $palette)

Definition at line 134 of file radar_chart.inc.

135  {
136  $this->palette = $palette;
137  }

◆ setRadius()

RadarChart::setRadius (   $r)

Definition at line 103 of file radar_chart.inc.

104  {
105  $this->radius = $r;
106  }

◆ setSize()

RadarChart::setSize (   $width,
  $height 
)

Definition at line 82 of file radar_chart.inc.

83  {
84  $this->width = $width;
85  $this->height = $height;
86  if (!$this->cx) $this->cx = $this->width / 2;
87  if (!$this->cy) $this->cy = $this->height / 2;
88  if (!$this->radius) $this->radius = min($width, $height) * .4;
89  }

◆ setStrokeWidth()

RadarChart::setStrokeWidth (   $s)

Definition at line 113 of file radar_chart.inc.

114  {
115  $this->strokeWidth = $s;
116  }

◆ showLegend()

RadarChart::showLegend (   $show,
  $x = 0,
  $y = 0 
)

Definition at line 127 of file radar_chart.inc.

128  {
129  $this->legend = $show;
130  $this->legendX = $x;
131  $this->legendY = $y;
132  }

Member Data Documentation

◆ $animate

RadarChart::$animate = true

Definition at line 58 of file radar_chart.inc.

◆ $containerHeight

RadarChart::$containerHeight

Definition at line 46 of file radar_chart.inc.

◆ $containerWidth

RadarChart::$containerWidth

Definition at line 45 of file radar_chart.inc.

◆ $cx

RadarChart::$cx

Definition at line 47 of file radar_chart.inc.

◆ $cy

RadarChart::$cy

Definition at line 48 of file radar_chart.inc.

◆ $emboss

RadarChart::$emboss = false

Definition at line 60 of file radar_chart.inc.

◆ $fontFamily

RadarChart::$fontFamily = 'Arial, Helvetica'

Definition at line 71 of file radar_chart.inc.

◆ $height

RadarChart::$height

Definition at line 44 of file radar_chart.inc.

◆ $labels

RadarChart::$labels

Definition at line 53 of file radar_chart.inc.

◆ $labelSize

RadarChart::$labelSize = 12

Definition at line 56 of file radar_chart.inc.

◆ $legend

RadarChart::$legend = false

Definition at line 61 of file radar_chart.inc.

◆ $legendLineHeight

RadarChart::$legendLineHeight = 30

Definition at line 66 of file radar_chart.inc.

◆ $legendSwatchSize

RadarChart::$legendSwatchSize = 20

Definition at line 65 of file radar_chart.inc.

◆ $legendX

RadarChart::$legendX = 0

Definition at line 62 of file radar_chart.inc.

◆ $legendY

RadarChart::$legendY = 0

Definition at line 63 of file radar_chart.inc.

◆ $max

RadarChart::$max = 0

Definition at line 49 of file radar_chart.inc.

◆ $min

RadarChart::$min = 0

Definition at line 50 of file radar_chart.inc.

◆ $onLegendClick

RadarChart::$onLegendClick = "null"

Definition at line 69 of file radar_chart.inc.

◆ $onLegendOut

RadarChart::$onLegendOut = "null"

Definition at line 68 of file radar_chart.inc.

◆ $onLegendOver

RadarChart::$onLegendOver = "null"

Definition at line 67 of file radar_chart.inc.

◆ $palette

RadarChart::$palette

Definition at line 54 of file radar_chart.inc.

◆ $radius

RadarChart::$radius

Definition at line 51 of file radar_chart.inc.

◆ $scaleToFit

RadarChart::$scaleToFit = false

Definition at line 70 of file radar_chart.inc.

◆ $shadow

RadarChart::$shadow = true

Definition at line 59 of file radar_chart.inc.

◆ $strokeWidth

RadarChart::$strokeWidth = 1

Definition at line 57 of file radar_chart.inc.

◆ $ticks

RadarChart::$ticks = 10

Definition at line 55 of file radar_chart.inc.

◆ $titleSize

RadarChart::$titleSize = 20

Definition at line 64 of file radar_chart.inc.

◆ $values

RadarChart::$values

Definition at line 52 of file radar_chart.inc.

◆ $width

RadarChart::$width

Definition at line 43 of file radar_chart.inc.


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