CMS  Version 3.9
Dial Class Reference

Public Member Functions

 __construct ($id, $width=300, $height=300, $value=0, $label='', $palette="standard")
 
 setSize ($width, $height)
 
 setContainerSize ($width, $height="0")
 
 setCenter ($cx, $cy)
 
 setRadius ($r)
 
 setLabelSize ($size, $targetLabelSize="inherit")
 
 setLabelPosition ($lx, $ly)
 
 setRange ($min, $max)
 
 setColorRange ($min, $max=null)
 
 setStrokeWidth ($s)
 
 setFontFamily ($font)
 
 showTarget ($target, $targetLabel)
 
 draw ()
 

Public Attributes

 $width
 
 $height
 
 $containerWidth
 
 $containerHeight
 
 $cx
 
 $cy
 
 $radius = 0
 
 $value = 0
 
 $label = ""
 
 $palette
 
 $labelSize = 12
 
 $labelX
 
 $labelY
 
 $strokeWidth = 1
 
 $animate = true
 
 $shadow = true
 
 $scaleToFit = false
 
 $fontFamily = 'Arial, Helvetica'
 
 $min = 0
 
 $max = 100
 
 $minColor = '#f00'
 
 $maxColor = '#0f0'
 
 $colorMode = 'fixed'
 
 $showTarget = false
 
 $target = 0
 
 $targetLabel = ""
 
 $targetLabelSize = "inherit"
 
 $cssClass = null
 
 $onDrawChart = "null"
 
 $onDrawChartComplete = "null"
 
 $onDrawLegend = "null"
 
 $onDrawLegendComplete = "null"
 

Detailed Description

Definition at line 41 of file dial.inc.

Constructor & Destructor Documentation

◆ __construct()

Dial::__construct (   $id,
  $width = 300,
  $height = 300,
  $value = 0,
  $label = '',
  $palette = "standard" 
)

Definition at line 76 of file dial.inc.

77  {
78  $this->id = $id;
79  $this->setSize($width, $height);
81  $this->value = $value;
82  $this->label = $label;
83  $this->palette = $palette;
84  }
$label
Definition: dial.inc:51
$width
Definition: dial.inc:43
setSize($width, $height)
Definition: dial.inc:86
$palette
Definition: dial.inc:52
$value
Definition: dial.inc:50
setContainerSize($width, $height="0")
Definition: dial.inc:95
$height
Definition: dial.inc:44

Member Function Documentation

◆ draw()

Dial::draw ( )

Definition at line 167 of file dial.inc.

168  {
169  global $script;
170  $animate = $this->animate ? "true" : "false";
171  $shadow = $this->shadow ? "true": "false";
172  $legend = $this->legend ? "true" : "false";
173  $percentages = $this->showPercentages ? "true" : "false";
174  $download = $this->enableDownload ? "true" : "false";
175  $showTarget = $this->showTarget ? "true" : "false";
176  $targetLabel = jsSafe($this->targetLabel);
177  $target = ($this->target == '') ? 0 : $this->target;
178 
179  $containerWidth = is_numeric($this->containerWidth) ? $this->containerWidth . "px" : $this->containerWidth;
180  $containerHeight = is_numeric($this->containerHeight) ? $this->containerHeight . "px" : $this->containerHeight;
181 
182  $script .= <<<ENDSCRIPT
183 <script type="text/javascript">
184 window.addEvent('domready', function ()
185 {
186  var {$this->id} = new Dial('{$this->id}', $this->value, '{$this->label}',
187  {
188  width: {$this->width},
189  height: {$this->height},
190  cx: {$this->cx},
191  cy: {$this->cy},
192  radius: {$this->radius},
193  palette: '{$this->palette}',
194  labelSize: {$this->labelSize},
195  labelx: {$this->labelX},
196  labely: {$this->labelY},
197  fontFamily: '{$this->fontFamily}',
198  strokeWidth: {$this->strokeWidth},
199  animate: {$animate},
200  shadow: {$shadow},
201  enableDownload: {$download},
202  min: {$this->min},
203  max: {$this->max},
204  minColor: '{$this->minColor}',
205  maxColor: '{$this->maxColor}',
206  colorMode: '{$this->colorMode}',
208  target: {$target},
209  targetLabel: '{$targetLabel}',
210  targetLabelSize: '{$this->targetLabelSize}',
211  onDrawChart: {$this->onDrawChart},
212  onDrawChartComplete: {$this->onDrawChartComplete},
213  onDrawLegend: {$this->onDrawLegend},
214  onDrawLegendComplete: {$this->onDrawLegendComplete}
215  });
216 
217  {$this->id}.draw();
218 });
219 </script>
220 ENDSCRIPT;
221 
222  if ($this->scaleToFit)
223  {
224  $dimensions = "width: 100%; height: auto";
225  }
226  else
227  {
228  $dimensions = "width: {$containerWidth}; height: {$containerHeight};";
229  }
230 
231  $cssClass = ($this->cssClass) ? " class='{$this->cssClass}'" : "";
232  echo "<div id='{$this->id}'{$cssClass} style='$dimensions'></div>";
233  }
$helpTree width
Definition: tree.inc:45
$siteTree target
Definition: site_map.inc:56
Definition: dial.inc:42
$containerWidth
Definition: dial.inc:45
$shadow
Definition: dial.inc:58
$showTarget
Definition: dial.inc:66
$target
Definition: dial.inc:67
showTarget($target, $targetLabel)
Definition: dial.inc:160
$containerHeight
Definition: dial.inc:46
$animate
Definition: dial.inc:57
$targetLabel
Definition: dial.inc:68
draw()
Definition: dial.inc:167
$cssClass
Definition: dial.inc:70
$desc height
Definition: event_edit.inc:64
$dial scaleToFit
Definition: test_dial.inc:12
$dial shadow
Definition: test_dial.inc:11
$chart max

◆ setCenter()

Dial::setCenter (   $cx,
  $cy 
)

Definition at line 101 of file dial.inc.

102  {
103  $this->cx = $cx;
104  $this->cy = $cy;
105  }
$cy
Definition: dial.inc:48
$cx
Definition: dial.inc:47

◆ setColorRange()

Dial::setColorRange (   $min,
  $max = null 
)

Definition at line 130 of file dial.inc.

131  {
132  if (!$max)
133  {
134  $max = $min;
135  }
136 
137  if ($max == $min)
138  {
139  $this->colorMode = 'fixed';
140  }
141  else
142  {
143  $this->colorMode = 'interpolated';
144  }
145 
146  $this->minColor = $min;
147  $this->maxColor = $max;
148  }
$max
Definition: dial.inc:62
$min
Definition: dial.inc:61

◆ setContainerSize()

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

Definition at line 95 of file dial.inc.

96  {
97  $this->containerWidth = $width;
98  $this->containerHeight = $height;
99  }

◆ setFontFamily()

Dial::setFontFamily (   $font)

Definition at line 155 of file dial.inc.

156  {
157  $this->fontFamily = $font;
158  }

◆ setLabelPosition()

Dial::setLabelPosition (   $lx,
  $ly 
)

Definition at line 118 of file dial.inc.

119  {
120  $this->labelX = $lx;
121  $this->labelY = $ly;
122  }

◆ setLabelSize()

Dial::setLabelSize (   $size,
  $targetLabelSize = "inherit" 
)

Definition at line 112 of file dial.inc.

113  {
114  $this->labelSize = $size;
115  $this->targetLabelSize = $targetLabelSize;
116  }
$size
Definition: download.inc:47
$targetLabelSize
Definition: dial.inc:69

◆ setRadius()

Dial::setRadius (   $r)

Definition at line 107 of file dial.inc.

108  {
109  $this->radius = $r;
110  }

◆ setRange()

Dial::setRange (   $min,
  $max 
)

Definition at line 124 of file dial.inc.

125  {
126  $this->min = $min;
127  $this->max = $max;
128  }

◆ setSize()

Dial::setSize (   $width,
  $height 
)

Definition at line 86 of file dial.inc.

87  {
88  $this->width = $width;
89  $this->height = $height;
90  if (!$this->cx) $this->cx = $this->width / 2;
91  if (!$this->cy) $this->cy = $this->height / 2;
92  if (!$this->radius) $this->radius = min($width, $height) * .4;
93  }

◆ setStrokeWidth()

Dial::setStrokeWidth (   $s)

Definition at line 150 of file dial.inc.

151  {
152  $this->strokeWidth = $s;
153  }

◆ showTarget()

Dial::showTarget (   $target,
  $targetLabel 
)

Definition at line 160 of file dial.inc.

161  {
162  $this->showTarget = true;
163  $this->target = $target;
164  $this->targetLabel = $targetLabel;
165  }

Member Data Documentation

◆ $animate

Dial::$animate = true

Definition at line 57 of file dial.inc.

◆ $colorMode

Dial::$colorMode = 'fixed'

Definition at line 65 of file dial.inc.

◆ $containerHeight

Dial::$containerHeight

Definition at line 46 of file dial.inc.

◆ $containerWidth

Dial::$containerWidth

Definition at line 45 of file dial.inc.

◆ $cssClass

Dial::$cssClass = null

Definition at line 70 of file dial.inc.

◆ $cx

Dial::$cx

Definition at line 47 of file dial.inc.

◆ $cy

Dial::$cy

Definition at line 48 of file dial.inc.

◆ $fontFamily

Dial::$fontFamily = 'Arial, Helvetica'

Definition at line 60 of file dial.inc.

◆ $height

Dial::$height

Definition at line 44 of file dial.inc.

◆ $label

Dial::$label = ""

Definition at line 51 of file dial.inc.

◆ $labelSize

Dial::$labelSize = 12

Definition at line 53 of file dial.inc.

◆ $labelX

Dial::$labelX

Definition at line 54 of file dial.inc.

◆ $labelY

Dial::$labelY

Definition at line 55 of file dial.inc.

◆ $max

Dial::$max = 100

Definition at line 62 of file dial.inc.

◆ $maxColor

Dial::$maxColor = '#0f0'

Definition at line 64 of file dial.inc.

◆ $min

Dial::$min = 0

Definition at line 61 of file dial.inc.

◆ $minColor

Dial::$minColor = '#f00'

Definition at line 63 of file dial.inc.

◆ $onDrawChart

Dial::$onDrawChart = "null"

Definition at line 71 of file dial.inc.

◆ $onDrawChartComplete

Dial::$onDrawChartComplete = "null"

Definition at line 72 of file dial.inc.

◆ $onDrawLegend

Dial::$onDrawLegend = "null"

Definition at line 73 of file dial.inc.

◆ $onDrawLegendComplete

Dial::$onDrawLegendComplete = "null"

Definition at line 74 of file dial.inc.

◆ $palette

Dial::$palette

Definition at line 52 of file dial.inc.

◆ $radius

Dial::$radius = 0

Definition at line 49 of file dial.inc.

◆ $scaleToFit

Dial::$scaleToFit = false

Definition at line 59 of file dial.inc.

◆ $shadow

Dial::$shadow = true

Definition at line 58 of file dial.inc.

◆ $showTarget

Dial::$showTarget = false

Definition at line 66 of file dial.inc.

◆ $strokeWidth

Dial::$strokeWidth = 1

Definition at line 56 of file dial.inc.

◆ $target

Dial::$target = 0

Definition at line 67 of file dial.inc.

◆ $targetLabel

Dial::$targetLabel = ""

Definition at line 68 of file dial.inc.

◆ $targetLabelSize

Dial::$targetLabelSize = "inherit"

Definition at line 69 of file dial.inc.

◆ $value

Dial::$value = 0

Definition at line 50 of file dial.inc.

◆ $width

Dial::$width

Definition at line 43 of file dial.inc.


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