| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<title>Circular Gauge Sample</title> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| 6 |
<link rel="stylesheet" type="text/css" href="../../../dijit/themes/claro/claro.css"> |
| 7 |
</head> |
| 8 |
<script type="text/javascript"> |
| 9 |
var djConfig = { |
| 10 |
parseOnLoad: true, |
| 11 |
isDebug: true |
| 12 |
} |
| 13 |
</script> |
| 14 |
<script type="text/javascript" src="../../../dojo/dojo.js"> |
| 15 |
</script> |
| 16 |
<script type="text/javascript"> |
| 17 |
dojo.require("dijit.dijit"); // optimize: load dijit layer |
| 18 |
dojo.require("dijit.layout.BorderContainer"); |
| 19 |
dojo.require("dijit.layout.ContentPane"); |
| 20 |
dojo.require("dijit.ColorPalette"); |
| 21 |
|
| 22 |
dojo.require('dijit.form.Button'); |
| 23 |
dojo.require('dijit.form.CheckBox'); |
| 24 |
dojo.require("dijit.form.ComboBox"); |
| 25 |
dojo.require("dijit.form.HorizontalSlider"); |
| 26 |
dojo.require("dijit.TitlePane"); |
| 27 |
|
| 28 |
dojo.require('dojox.gauges.GlossyCircularGauge'); |
| 29 |
dojo.require('dojox.gauges.GlossySemiCircularGauge'); |
| 30 |
dojo.require("dojo.parser"); |
| 31 |
|
| 32 |
dojo.addOnLoad(sample); |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
var glossyCircular = null; |
| 37 |
var glossyCircular2 = null; |
| 38 |
|
| 39 |
function sample(){ |
| 40 |
|
| 41 |
// create an glossy Circular Gauge |
| 42 |
glossyCircular = new dojox.gauges.GlossyCircularGauge({ |
| 43 |
background: [255, 255, 255, 0], |
| 44 |
title: 'Value', |
| 45 |
id: "glossyGauge", |
| 46 |
width: 300, |
| 47 |
height: 300 |
| 48 |
}, dojo.byId("CircularGauge")); |
| 49 |
glossyCircular.startup(); |
| 50 |
|
| 51 |
// create an glossy semi Circular Gauge |
| 52 |
glossyCircular2 = new dojox.gauges.GlossySemiCircularGauge({ |
| 53 |
title: 'Value', |
| 54 |
background: [255, 255, 255, 0], |
| 55 |
id: "glossyGauge2", |
| 56 |
width: 300, |
| 57 |
height: 300 |
| 58 |
}, dojo.byId("SemiCircularGauge")); |
| 59 |
glossyCircular2.startup(); |
| 60 |
|
| 61 |
} |
| 62 |
|
| 63 |
function changeOrientation(orientation){ |
| 64 |
var t = glossyCircular.startAngle; |
| 65 |
glossyCircular.startAngle = glossyCircular.endAngle; |
| 66 |
glossyCircular.endAngle = t; |
| 67 |
glossyCircular.set('orientation', orientation); |
| 68 |
|
| 69 |
t = glossyCircular2.startAngle; |
| 70 |
glossyCircular2.startAngle = glossyCircular2.endAngle; |
| 71 |
glossyCircular2.endAngle = t; |
| 72 |
glossyCircular2.set('orientation', orientation); |
| 73 |
} |
| 74 |
|
| 75 |
function changeGaugeColor(v){ |
| 76 |
glossyCircular.set('color', v); |
| 77 |
glossyCircular2.set('color', v) |
| 78 |
} |
| 79 |
|
| 80 |
function changeNeedleColor(v){ |
| 81 |
glossyCircular.set('needleColor', v); |
| 82 |
glossyCircular2.set('needleColor', v) |
| 83 |
} |
| 84 |
|
| 85 |
function changeMinorTicksColor(v){ |
| 86 |
glossyCircular.set('minorTicksColor', v); |
| 87 |
glossyCircular2.set('minorTicksColor', v) |
| 88 |
} |
| 89 |
|
| 90 |
function changeMajorTicksColor(v){ |
| 91 |
glossyCircular.set('majorTicksColor', v); |
| 92 |
glossyCircular2.set('majorTicksColor', v) |
| 93 |
} |
| 94 |
|
| 95 |
function changeTextIndicatorColor(v){ |
| 96 |
glossyCircular.set('textIndicatorColor', v); |
| 97 |
glossyCircular2.set('textIndicatorColor', v) |
| 98 |
} |
| 99 |
</script> |
| 100 |
<body class="claro"> |
| 101 |
<table width="100%" border="0"> |
| 102 |
<tr> |
| 103 |
<td width="450px"> |
| 104 |
<div id="CircularGauge"> |
| 105 |
</div> |
| 106 |
<div id="SemiCircularGauge"> |
| 107 |
</div> |
| 108 |
</td> |
| 109 |
<td> |
| 110 |
<table border="0"> |
| 111 |
<tr> |
| 112 |
<td> |
| 113 |
Title |
| 114 |
</td> |
| 115 |
<td> |
| 116 |
<input type="text" value="Value" dojoType="dijit.form.TextBox" trim="true" onChange="glossyCircular.set('title',this.value);glossyCircular2.set('title',this.value)"> |
| 117 |
</td> |
| 118 |
</tr> |
| 119 |
<tr> |
| 120 |
<td> |
| 121 |
Clockwise orientation |
| 122 |
</td> |
| 123 |
<td> |
| 124 |
<div dojoType='dijit.form.CheckBox' checked onChange="changeOrientation(this.checked?'clockwise':'cclockwise')" /> |
| 125 |
</td> |
| 126 |
</tr> |
| 127 |
<tr> |
| 128 |
<td> |
| 129 |
Minimum |
| 130 |
</td> |
| 131 |
<td> |
| 132 |
<div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="glossyCircular.set('min',Math.round(this.value));glossyCircular2.set('min',Math.round(this.value))" value="0" minimum="0" maximum="200" discreteValues="200" showButtons="false" style="width: 200px; height: 20px"/> |
| 133 |
</td> |
| 134 |
</tr> |
| 135 |
<tr> |
| 136 |
<td> |
| 137 |
Maximum |
| 138 |
</td> |
| 139 |
<td> |
| 140 |
<div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="glossyCircular.set('max',Math.round(this.value));glossyCircular2.set('max',Math.round(this.value))" value="100" minimum="0" maximum="200" discreteValues="200" showButtons="false" style="width: 200px; height: 20px"/> |
| 141 |
</td> |
| 142 |
</tr> |
| 143 |
<tr> |
| 144 |
<td> |
| 145 |
Gauge Color |
| 146 |
</td> |
| 147 |
<td> |
| 148 |
<div id='gaugeColorPicker' dojoType='dijit.ColorPalette' onChange="changeGaugeColor" palette="3x4"/> |
| 149 |
</td> |
| 150 |
</tr> |
| 151 |
<tr> |
| 152 |
<td> |
| 153 |
Needle Color |
| 154 |
</td> |
| 155 |
<td> |
| 156 |
<div id='needleColorPicker' dojoType='dijit.ColorPalette' onChange='changeNeedleColor' palette="3x4"/> |
| 157 |
</td> |
| 158 |
</tr> |
| 159 |
<tr> |
| 160 |
<td> |
| 161 |
Text Indicator Color |
| 162 |
</td> |
| 163 |
<td> |
| 164 |
<div id='textColorPicker' dojoType='dijit.ColorPalette' onChange='changeTextIndicatorColor' palette="3x4"/> |
| 165 |
</td> |
| 166 |
</tr> |
| 167 |
<tr> |
| 168 |
<td> |
| 169 |
Scale font |
| 170 |
</td> |
| 171 |
<td> |
| 172 |
<div dojoType='dijit.form.Button' onClick="glossyCircular.set('font','italic normal normal 18pt serif');glossyCircular2.set('font','italic normal normal 18pt serif')"> |
| 173 |
Sample #1 |
| 174 |
</div> |
| 175 |
<div dojoType='dijit.form.Button' onClick="glossyCircular.set('font','normal normal bold 12pt serif');glossyCircular2.set('font','normal normal bold 12pt serif')"> |
| 176 |
Sample #2 |
| 177 |
</div> |
| 178 |
<div dojoType='dijit.form.Button' onClick="glossyCircular.set('font','normal normal normal 10pt serif');glossyCircular2.set('font','normal normal normal 10pt serif')"> |
| 179 |
Default |
| 180 |
</div> |
| 181 |
</td> |
| 182 |
</tr> |
| 183 |
<tr> |
| 184 |
<td> |
| 185 |
Text Indicator font |
| 186 |
</td> |
| 187 |
<td> |
| 188 |
<div dojoType='dijit.form.Button' onClick="glossyCircular.set('textIndicatorFont','normal small-caps bold 12pt Arial');glossyCircular2.set('textIndicatorFont','normal small-caps bold 12pt Arial')"> |
| 189 |
Sample #1 |
| 190 |
</div> |
| 191 |
<div dojoType='dijit.form.Button' onClick="glossyCircular.set('textIndicatorFont','italic normal normal 30pt Arial');glossyCircular2.set('textIndicatorFont','italic normal normal 30pt Arial')"> |
| 192 |
Sample #2 |
| 193 |
</div> |
| 194 |
<div dojoType='dijit.form.Button' onClick="glossyCircular.set('textIndicatorFont','normal normal normal 20pt Arial,sans-serif');glossyCircular2.set('textIndicatorFont','normal normal normal 20pt Arial,sans-serif')"> |
| 195 |
Default |
| 196 |
</div> |
| 197 |
</td> |
| 198 |
</tr> |
| 199 |
<tr> |
| 200 |
<td> |
| 201 |
Display text indicator |
| 202 |
</td> |
| 203 |
<td> |
| 204 |
<div dojoType='dijit.form.CheckBox' checked onChange="glossyCircular.set('textIndicatorVisible',this.checked);glossyCircular2.set('textIndicatorVisible',this.checked)" /> |
| 205 |
</td> |
| 206 |
</tr> |
| 207 |
<tr> |
| 208 |
<td> |
| 209 |
Allow interaction |
| 210 |
</td> |
| 211 |
<td> |
| 212 |
<div dojoType='dijit.form.CheckBox' checked onChange="glossyCircular.set('noChange',!this.checked);glossyCircular2.set('noChange',!this.checked)" /> |
| 213 |
</td> |
| 214 |
</tr> |
| 215 |
<tr> |
| 216 |
<table border="0" width="100%"> |
| 217 |
<tr align="left"> |
| 218 |
<td title="Major Ticks"> |
| 219 |
<table> |
| 220 |
<tr> |
| 221 |
<td> |
| 222 |
Major Ticks interval |
| 223 |
</td> |
| 224 |
<td> |
| 225 |
<div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="glossyCircular.set('majorTicksInterval',this.value);glossyCircular2.set('majorTicksInterval',this.value)" value="10" minimum="1" maximum="100" discreteValues="100" showButtons="false" style="width: 200px; height: 20px"/> |
| 226 |
</td> |
| 227 |
</tr> |
| 228 |
<tr> |
| 229 |
<td> |
| 230 |
Major Ticks length |
| 231 |
</td> |
| 232 |
<td> |
| 233 |
<div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="glossyCircular.setMajorTicksLength(this.value);glossyCircular2.setMajorTicksLength(this.value)" value="5" minimum="1" maximum="15" discreteValues="1" showButtons="false" style="width: 200px; height: 20px"/> |
| 234 |
</td> |
| 235 |
</tr> |
| 236 |
<tr> |
| 237 |
<td> |
| 238 |
Major Ticks Color |
| 239 |
</td> |
| 240 |
<td> |
| 241 |
<div dojoType='dijit.ColorPalette' onChange="changeMajorTicksColor" palette="3x4"/> |
| 242 |
</td> |
| 243 |
</tr> |
| 244 |
<tr> |
| 245 |
<td> |
| 246 |
Label placement inside |
| 247 |
</td> |
| 248 |
<td> |
| 249 |
<div dojoType='dijit.form.CheckBox' checked onChange="glossyCircular.set('majorTicksLabelPlacement',this.checked?'inside':'outside');glossyCircular2.set('majorTicksLabelPlacement',this.checked?'inside':'outside')" /> |
| 250 |
</td> |
| 251 |
</tr> |
| 252 |
</table> |
| 253 |
</td> |
| 254 |
<td title="Minor Ticks"> |
| 255 |
<table> |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
<tr> |
| 267 |
<td> |
| 268 |
Minor Ticks interval |
| 269 |
</td> |
| 270 |
<td> |
| 271 |
<div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="glossyCircular.set('minorTicksInterval',this.value);glossyCircular2.set('minorTicksInterval',this.value)" value="10" minimum="1" maximum="100" discreteValues="100" showButtons="false" style="width: 200px; height: 20px"/> |
| 272 |
</td> |
| 273 |
</tr> |
| 274 |
<tr> |
| 275 |
<td> |
| 276 |
Minor Ticks length |
| 277 |
</td> |
| 278 |
<td> |
| 279 |
<div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="glossyCircular.setMinorTicksLength(this.value);glossyCircular2.setMinorTicksLength(this.value)" value="5" minimum="1" maximum="15" discreteValues="1" showButtons="false" style="width: 200px; height: 20px"/> |
| 280 |
</td> |
| 281 |
</tr> |
| 282 |
<tr> |
| 283 |
<td> |
| 284 |
Minor Ticks Color |
| 285 |
</td> |
| 286 |
<td> |
| 287 |
<div dojoType='dijit.ColorPalette' onChange="changeMinorTicksColor" palette="3x4"/> |
| 288 |
</td> |
| 289 |
</tr> |
| 290 |
</table> |
| 291 |
</td> |
| 292 |
</tr> |
| 293 |
</table> |
| 294 |
</tr> |
| 295 |
</table> |
| 296 |
</td> |
| 297 |
</tr> |
| 298 |
</table> |
| 299 |
</body> |
| 300 |
</html> |