| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Analog Gauge Widget Indicators</title> |
| 5 | <style> |
| 6 | @import "../_Gauge.css"; |
| 7 | @import "../../../dojo/resources/dojo.css"; |
| 8 | @import "../../../dijit/themes/tundra/tundra.css"; |
| 9 | </style> |
| 10 | <script type="text/javascript"> |
| 11 | djConfig = { |
| 12 | parseOnLoad: true, |
| 13 | isDebug: true |
| 14 | }; |
| 15 | </script> |
| 16 | <script type="text/javascript" src="../../../dojo/dojo.js"> |
| 17 | </script> |
| 18 | <script language="JavaScript" type="text/javascript"> |
| 19 | dojo.require('dojox.gauges.AnalogGauge'); |
| 20 | dojo.require('dojox.gauges.AnalogArcIndicator'); |
| 21 | dojo.require('dojox.gauges.AnalogNeedleIndicator'); |
| 22 | dojo.require('dojox.gauges.AnalogCircleIndicator'); |
| 23 | dojo.require('dojox.gauges.TextIndicator'); |
| 24 | dojo.require('dijit.form.Button'); |
| 25 | dojo.require('dojo.parser'); |
| 26 | |
| 27 | dojo.addOnLoad(init); |
| 28 | |
| 29 | |
| 30 | function init(){ |
| 31 | var gauge = new dojox.gauges.AnalogGauge({ |
| 32 | |
| 33 | background: [200, 200, 200], |
| 34 | id: "gauge", |
| 35 | width: 250, |
| 36 | height: 200, |
| 37 | cx: 125, |
| 38 | cy: 150, |
| 39 | radius: 125, |
| 40 | ranges: [{ |
| 41 | low: 0, |
| 42 | high: 100, |
| 43 | color: 'black' |
| 44 | }], |
| 45 | |
| 46 | majorTicks: { |
| 47 | offset: 90, |
| 48 | interval: 10, |
| 49 | length: 3, |
| 50 | color: 'white' |
| 51 | }, |
| 52 | |
| 53 | indicators: [new dojox.gauges.AnalogArcIndicator({ |
| 54 | value: 100, |
| 55 | width: 30, |
| 56 | offset: 60, |
| 57 | color: 'white', |
| 58 | noChange: true, |
| 59 | title: 'value', |
| 60 | hideValue: true |
| 61 | }), new dojox.gauges.AnalogArcIndicator({ |
| 62 | interactionMode: "gauge", |
| 63 | value: 20, |
| 64 | width: 20, |
| 65 | offset: 65, |
| 66 | color: 'gray', |
| 67 | noChange: false, |
| 68 | title: 'value', |
| 69 | hideValue: true |
| 70 | }), new dojox.gauges.TextIndicator({ |
| 71 | value: 20, |
| 72 | align: 'middle', |
| 73 | x: 125, |
| 74 | y: 135, |
| 75 | font: { |
| 76 | family: "Arial", |
| 77 | style: "normal", |
| 78 | variant: 'small-caps', |
| 79 | weight: 'bold', |
| 80 | size: "30px" |
| 81 | }, |
| 82 | hideValue: false, |
| 83 | color: 'gray' |
| 84 | })] |
| 85 | }, dojo.byId("gauge")); |
| 86 | |
| 87 | gauge.startup(); |
| 88 | |
| 89 | dojo.connect(gauge.indicators[1], "valueChanged", dojo.hitch(gauge, function(){ |
| 90 | this.indicators[2].update(this.indicators[1].value); |
| 91 | })); |
| 92 | |
| 93 | |
| 94 | gauge = new dojox.gauges.AnalogGauge({ |
| 95 | id: "gauge2", |
| 96 | startAngle: 0, |
| 97 | endAngle: 270, |
| 98 | background: 'white', |
| 99 | id: "defaultGauge", |
| 100 | width: 250, |
| 101 | height: 250, |
| 102 | cx: 127, |
| 103 | cy: 125, |
| 104 | radius: 125, |
| 105 | ranges: [{ |
| 106 | low: 0, |
| 107 | high: 100, |
| 108 | color: 'white' |
| 109 | }], |
| 110 | |
| 111 | majorTicks: { |
| 112 | offset: 95, |
| 113 | interval: 20, |
| 114 | length: 3, |
| 115 | color: 'black', |
| 116 | labelPlacement: 'outside' |
| 117 | }, |
| 118 | |
| 119 | indicators: [new dojox.gauges.AnalogArcIndicator({ |
| 120 | value: 1000, |
| 121 | width: 30, |
| 122 | offset: 65, |
| 123 | strokeColor: 'black', |
| 124 | color: 'white', |
| 125 | noChange: true, |
| 126 | title: 'value', |
| 127 | hideValue: true |
| 128 | }), new dojox.gauges.AnalogArcIndicator({ |
| 129 | value: 20, |
| 130 | width: 20, |
| 131 | offset: 70, |
| 132 | interactionMode: "gauge", |
| 133 | color: [122, 103, 140], |
| 134 | noChange: false, |
| 135 | title: 'value', |
| 136 | hideValue: true |
| 137 | }), new dojox.gauges.TextIndicator({ |
| 138 | value: 20, |
| 139 | align: 'middle', |
| 140 | x: 125, |
| 141 | y: 140, |
| 142 | font: { |
| 143 | family: "Arial", |
| 144 | style: "normal", |
| 145 | variant: 'small-caps', |
| 146 | weight: 'bold', |
| 147 | size: "40px" |
| 148 | }, |
| 149 | hideValue: false, |
| 150 | color: 'gray' |
| 151 | })] |
| 152 | }, dojo.byId("gauge2")); |
| 153 | |
| 154 | gauge.startup(); |
| 155 | |
| 156 | dojo.connect(gauge.indicators[1], "valueChanged", dojo.hitch(gauge, function(){ |
| 157 | this.indicators[2].update(this.indicators[1].value); |
| 158 | })); |
| 159 | |
| 160 | |
| 161 | gauge = new dojox.gauges.AnalogGauge({ |
| 162 | id: "gauge3", |
| 163 | startAngle: -30, |
| 164 | endAngle: 30, |
| 165 | background: 'white', |
| 166 | width: 200, |
| 167 | height: 180, |
| 168 | cx: 100, |
| 169 | cy: 150, |
| 170 | radius: 130, |
| 171 | ranges: [{ |
| 172 | low: -30, |
| 173 | high: 30, |
| 174 | color: 'white' |
| 175 | }], |
| 176 | |
| 177 | majorTicks: { |
| 178 | offset: 100, |
| 179 | interval: 10, |
| 180 | length: 3, |
| 181 | color: 'black', |
| 182 | labelPlacement: 'outside' |
| 183 | }, |
| 184 | |
| 185 | indicators: [new dojox.gauges.AnalogNeedleIndicator({ |
| 186 | interactionMode: "gauge", |
| 187 | value: 0, |
| 188 | width: 10, |
| 189 | length: 100, |
| 190 | strokeColor: [100, 100, 100], |
| 191 | color: [200, 200, 200] |
| 192 | })] |
| 193 | }, dojo.byId("gauge3")); |
| 194 | |
| 195 | gauge.startup(); |
| 196 | |
| 197 | |
| 198 | gauge = new dojox.gauges.AnalogGauge({ |
| 199 | id: "gauge4", |
| 200 | startAngle: 20, |
| 201 | endAngle: 20, |
| 202 | background: 'white', |
| 203 | width: 200, |
| 204 | height: 200, |
| 205 | cx: 100, |
| 206 | cy: 100, |
| 207 | radius: 95, |
| 208 | ranges: [{ |
| 209 | low: 0, |
| 210 | high: 8, |
| 211 | color: [50, 90, 102] |
| 212 | }], |
| 213 | |
| 214 | majorTicks: { |
| 215 | offset: 70, |
| 216 | interval: 1, |
| 217 | length: 3, |
| 218 | color: 'white', |
| 219 | labelPlacement: 'outside' |
| 220 | }, |
| 221 | |
| 222 | indicators: [new dojox.gauges.AnalogCircleIndicator({ |
| 223 | interactionMode: "gauge", |
| 224 | offset: 45, |
| 225 | value: 5, |
| 226 | length: 10, |
| 227 | strokeColor: [163, 43, 38], |
| 228 | color: [222, 161, 64] |
| 229 | |
| 230 | }), new dojox.gauges.AnalogArcIndicator({ |
| 231 | value: 7, |
| 232 | width: 10, |
| 233 | offset: 60, |
| 234 | |
| 235 | color: [255, 248, 178], |
| 236 | noChange: true, |
| 237 | title: 'value', |
| 238 | hideValue: true |
| 239 | })] |
| 240 | }, dojo.byId("gauge4")); |
| 241 | |
| 242 | gauge.startup(); |
| 243 | |
| 244 | } |
| 245 | </script> |
| 246 | </head> |
| 247 | <body class="tundra"> |
| 248 | <h1>Analog Gauge Widget Indicators</h1> |
| 249 | <ul class="lst"> |
| 250 | <li> |
| 251 | Arc and Text indicators |
| 252 | </li> |
| 253 | </ul> |
| 254 | <div id="gauge"> |
| 255 | </div> |
| 256 | <ul class="lst"> |
| 257 | <li> |
| 258 | Arc and Text indicators again. |
| 259 | </li> |
| 260 | </ul> |
| 261 | <div id="gauge2"> |
| 262 | </div> |
| 263 | <ul class="lst"> |
| 264 | <li> |
| 265 | Needle indicator. |
| 266 | </li> |
| 267 | </ul> |
| 268 | <div id="gauge3"> |
| 269 | </div> |
| 270 | <ul class="lst"> |
| 271 | <li> |
| 272 | Circle indicator. |
| 273 | </li> |
| 274 | </ul> |
| 275 | <div id="gauge4"> |
| 276 | </div> |
| 277 | </div> |
| 278 | </body> |
| 279 | </html> |