| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Horizontal 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 | |
| 11 | parseOnLoad: true, |
| 12 | isDebug: true |
| 13 | } |
| 14 | </script> |
| 15 | <script type="text/javascript" src="../../../dojo/dojo.js"> |
| 16 | </script> |
| 17 | <script type="text/javascript"> |
| 18 | dojo.require("dijit.dijit"); // optimize: load dijit layer |
| 19 | dojo.require("dijit.layout.BorderContainer"); |
| 20 | dojo.require("dijit.layout.ContentPane"); |
| 21 | dojo.require("dijit.ColorPalette"); |
| 22 | |
| 23 | dojo.require('dijit.form.Button'); |
| 24 | dojo.require('dijit.form.CheckBox'); |
| 25 | dojo.require("dijit.form.ComboBox"); |
| 26 | dojo.require("dijit.form.HorizontalSlider"); |
| 27 | dojo.require("dijit.TitlePane"); |
| 28 | |
| 29 | dojo.require('dojox.gauges.GlossyHorizontalGauge'); |
| 30 | dojo.require("dojo.parser"); |
| 31 | |
| 32 | dojo.addOnLoad(sample); |
| 33 | |
| 34 | var gauge = null; |
| 35 | |
| 36 | function sample(){ |
| 37 | // create an Horizontal Gauge |
| 38 | gauge = new dojox.gauges.GlossyHorizontalGauge({ |
| 39 | background: [255, 255, 255, 0], |
| 40 | id: "glossyGauge", |
| 41 | title: "Value", |
| 42 | width: 400, |
| 43 | height: 100 |
| 44 | }, dojo.byId("HorizontalGauge")); |
| 45 | |
| 46 | gauge.startup(); |
| 47 | } |
| 48 | |
| 49 | function changeGaugeColor(v){ |
| 50 | gauge.set('color', v); |
| 51 | } |
| 52 | |
| 53 | function changeNeedleColor(v){ |
| 54 | gauge.set('markerColor', v); |
| 55 | } |
| 56 | |
| 57 | function changeMinorTicksColor(v){ |
| 58 | gauge.set('minorTicksColor', v); |
| 59 | } |
| 60 | |
| 61 | function changeMajorTicksColor(v){ |
| 62 | gauge.set('majorTicksColor', v); |
| 63 | } |
| 64 | </script> |
| 65 | <body class="claro"> |
| 66 | <table width="100%" border="0"> |
| 67 | <tr> |
| 68 | <td width="450px"> |
| 69 | <div id="HorizontalGauge"> |
| 70 | </div> |
| 71 | </td> |
| 72 | <td> |
| 73 | <table border="0"> |
| 74 | <tr> |
| 75 | <td> |
| 76 | Title |
| 77 | </td> |
| 78 | <td> |
| 79 | <input type="text" value="Value" dojoType="dijit.form.TextBox" trim="true" onChange="gauge.set('title',this.value);"> |
| 80 | </td> |
| 81 | </tr> |
| 82 | <tr> |
| 83 | <td> |
| 84 | Minimum |
| 85 | </td> |
| 86 | <td> |
| 87 | <div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="gauge.set('min',Math.round(this.value));" value="0" minimum="0" maximum="200" discreteValues="200" showButtons="false" style="width: 200px; height: 20px"/> |
| 88 | </td> |
| 89 | </tr> |
| 90 | <tr> |
| 91 | <td> |
| 92 | Maximum |
| 93 | </td> |
| 94 | <td> |
| 95 | <div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="gauge.set('max',Math.round(this.value));" value="100" minimum="0" maximum="200" discreteValues="200" showButtons="false" style="width: 200px; height: 20px"/> |
| 96 | </td> |
| 97 | </tr> |
| 98 | <tr> |
| 99 | <td> |
| 100 | Gauge Color |
| 101 | </td> |
| 102 | <td> |
| 103 | <div id='gaugeColorPicker' dojoType='dijit.ColorPalette' onChange="changeGaugeColor" palette="3x4"/> |
| 104 | </td> |
| 105 | </tr> |
| 106 | <tr> |
| 107 | <td> |
| 108 | Needle Color |
| 109 | </td> |
| 110 | <td> |
| 111 | <div id='needleColorPicker' dojoType='dijit.ColorPalette' onChange="changeNeedleColor" palette="3x4"/> |
| 112 | </td> |
| 113 | </tr> |
| 114 | <tr> |
| 115 | <td> |
| 116 | Scale font |
| 117 | </td> |
| 118 | <td> |
| 119 | <div dojoType='dijit.form.Button' onClick="gauge.set('font','italic normal normal 18pt Arial,sans-serif')"> |
| 120 | Sample #1 |
| 121 | </div> |
| 122 | <div dojoType='dijit.form.Button' onClick="gauge.set('font','normal normal bold 12pt Arial,sans-serif')"> |
| 123 | Sample #2 |
| 124 | </div> |
| 125 | <div dojoType='dijit.form.Button' onClick="gauge.set('font','normal normal normal 10pt serif')"> |
| 126 | Default |
| 127 | </div> |
| 128 | </td> |
| 129 | </tr> |
| 130 | <tr> |
| 131 | <td> |
| 132 | Allow interaction |
| 133 | </td> |
| 134 | <td> |
| 135 | <div dojoType='dijit.form.CheckBox' checked onChange="gauge.set('noChange',!this.checked);" /> |
| 136 | </td> |
| 137 | </tr> |
| 138 | <tr> |
| 139 | <table border="0" width="100%"> |
| 140 | <tr align="left"> |
| 141 | <td title="Major Ticks"> |
| 142 | <table> |
| 143 | <tr> |
| 144 | <td> |
| 145 | Major Ticks interval |
| 146 | </td> |
| 147 | <td> |
| 148 | <div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="gauge.set('majorTicksInterval',this.value);" value="10" minimum="1" maximum="100" discreteValues="100" showButtons="false" style="width: 200px; height: 20px"/> |
| 149 | </td> |
| 150 | </tr> |
| 151 | <tr> |
| 152 | <td> |
| 153 | Major Ticks length |
| 154 | </td> |
| 155 | <td> |
| 156 | <div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="gauge.setMajorTicksLength(this.value)" value="5" minimum="1" maximum="15" discreteValues="1" showButtons="false" style="width: 200px; height: 20px"/> |
| 157 | </td> |
| 158 | </tr> |
| 159 | <tr> |
| 160 | <td> |
| 161 | Major Ticks Color |
| 162 | </td> |
| 163 | <td> |
| 164 | <div dojoType='dijit.ColorPalette' onChange="changeMajorTicksColor" palette="3x4"/> |
| 165 | </td> |
| 166 | </tr> |
| 167 | </table> |
| 168 | </td> |
| 169 | <td title="Minor Ticks"> |
| 170 | <table> |
| 171 | <tr> |
| 172 | <td> |
| 173 | Minor Ticks interval |
| 174 | </td> |
| 175 | <td> |
| 176 | <div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="gauge.set('minorTicksInterval',this.value);" value="10" minimum="1" maximum="100" discreteValues="100" showButtons="false" style="width: 200px; height: 20px"/> |
| 177 | </td> |
| 178 | </tr> |
| 179 | <tr> |
| 180 | <td> |
| 181 | Minor Ticks length |
| 182 | </td> |
| 183 | <td> |
| 184 | <div dojoType='dijit.form.HorizontalSlider' intermediateChanges="true" onChange="gauge.setMinorTicksLength(this.value)" value="5" minimum="1" maximum="15" discreteValues="1" showButtons="false" style="width: 200px; height: 20px"/> |
| 185 | </td> |
| 186 | </tr> |
| 187 | <tr> |
| 188 | <td> |
| 189 | Minor Ticks Color |
| 190 | </td> |
| 191 | <td> |
| 192 | <div dojoType='dijit.ColorPalette' onChange="changeMinorTicksColor" palette="3x4"/> |
| 193 | </td> |
| 194 | </tr> |
| 195 | </table> |
| 196 | </td> |
| 197 | </tr> |
| 198 | </table> |
| 199 | </tr> |
| 200 | </table> |
| 201 | </td> |
| 202 | </tr> |
| 203 | </table> |
| 204 | </body> |
| 205 | </html> |