| 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 Orientation</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.AnalogNeedleIndicator'); |
| 21 | dojo.require('dijit.form.Button'); |
| 22 | dojo.require('dojo.parser'); |
| 23 | |
| 24 | dojo.addOnLoad(init); |
| 25 | |
| 26 | |
| 27 | function init(){ |
| 28 | |
| 29 | |
| 30 | var gauge = new dojox.gauges.AnalogGauge({ |
| 31 | id: "gauge", |
| 32 | |
| 33 | startAngle: 30, |
| 34 | endAngle: 30, |
| 35 | background: 'white', |
| 36 | width: 200, |
| 37 | height: 200, |
| 38 | cx: 100, |
| 39 | cy: 100, |
| 40 | radius: 100, |
| 41 | ranges: [{ |
| 42 | low: 1, |
| 43 | high: 13, |
| 44 | color: [200, 200, 200] |
| 45 | }], |
| 46 | |
| 47 | majorTicks: { |
| 48 | offset: 80, |
| 49 | interval: 1, |
| 50 | length: 5, |
| 51 | color: 'white', |
| 52 | labelPlacement: 'inside' |
| 53 | }, |
| 54 | |
| 55 | indicators: [new dojox.gauges.AnalogNeedleIndicator({ |
| 56 | interactionMode: "gauge", |
| 57 | value: 12, |
| 58 | width: 5, |
| 59 | length: 50, |
| 60 | strokeColor: [100, 100, 100], |
| 61 | color: 'white' |
| 62 | |
| 63 | })] |
| 64 | }, dojo.byId("gauge")); |
| 65 | |
| 66 | gauge.startup(); |
| 67 | |
| 68 | dojo.connect(dijit.byId('btn'), 'onClick', function(){ |
| 69 | var o = gauge.majorTicks; |
| 70 | if (o.labelPlacement == 'outside') { |
| 71 | o.labelPlacement = 'inside'; |
| 72 | o.offset = 80; |
| 73 | } else { |
| 74 | o.labelPlacement = 'outside'; |
| 75 | o.offset = 60; |
| 76 | } |
| 77 | gauge.setMajorTicks(o); |
| 78 | }); |
| 79 | |
| 80 | } |
| 81 | </script> |
| 82 | </head> |
| 83 | <body class="tundra"> |
| 84 | <h1>Analog Gauge Widget Scale Label Placement</h1> |
| 85 | <div id="gauge"> |
| 86 | </div> |
| 87 | <button id="btn" dojoType='dijit.form.Button'> |
| 88 | Change label placement |
| 89 | </button> |
| 90 | </body> |
| 91 | </html> |