| 1 |
define(["dojo/_base/lang", "dojo/_base/declare", "dojox/dgauges/CircularGauge", "dojox/dgauges/LinearScaler", |
| 2 |
"dojox/dgauges/CircularScale", "dojox/dgauges/CircularValueIndicator", "dojox/dgauges/CircularRangeIndicator", |
| 3 |
"dojox/dgauges/TextIndicator"], |
| 4 |
function(lang, declare, CircularGauge, LinearScaler, CircularScale, CircularValueIndicator, CircularRangeIndicator, |
| 5 |
TextIndicator){ |
| 6 |
return declare("dojox.dgauges.tests.gauges.SimpleSemiCircularGauge", CircularGauge, { |
| 7 |
constructor: function(){ |
| 8 |
|
| 9 |
this.font = { |
| 10 |
family: "Helvetica", |
| 11 |
style: "normal", |
| 12 |
size: "10pt", |
| 13 |
color: "black" |
| 14 |
}; |
| 15 |
|
| 16 |
|
| 17 |
this.addElement("background", function(g){ |
| 18 |
g.createRect({ |
| 19 |
width: 200, |
| 20 |
height: 100 |
| 21 |
}); |
| 22 |
}); |
| 23 |
|
| 24 |
|
| 25 |
var scaler = new LinearScaler({ |
| 26 |
minimum: 0, |
| 27 |
maximum: 100 |
| 28 |
}); |
| 29 |
|
| 30 |
|
| 31 |
var scale = new CircularScale({ |
| 32 |
scaler: scaler, |
| 33 |
originX: 100, |
| 34 |
originY: 85, |
| 35 |
startAngle: 180, |
| 36 |
endAngle: 0, |
| 37 |
tickLabelFunc: function(){return null;}, |
| 38 |
tickShapeFunc: function(){return null;} |
| 39 |
}); |
| 40 |
this.addElement("scale", scale); |
| 41 |
|
| 42 |
|
| 43 |
var backgroundRange = new CircularRangeIndicator({ |
| 44 |
start: 0, |
| 45 |
value: 100, |
| 46 |
radius: 85, |
| 47 |
startThickness:30, |
| 48 |
endThickness: 30, |
| 49 |
fill:{ |
| 50 |
type: "radial", |
| 51 |
cx: 100, |
| 52 |
cy: 85, |
| 53 |
colors: [ |
| 54 |
{ offset: 0, color: "black" }, |
| 55 |
{ offset: 0.8, color: "#FAFAFA" }, |
| 56 |
{ offset: 1, color: "#AAAAAA" } |
| 57 |
] |
| 58 |
}, |
| 59 |
stroke: null, |
| 60 |
interactionMode: "none" |
| 61 |
}); |
| 62 |
scale.addIndicator("backgroundIndicator", backgroundRange); |
| 63 |
|
| 64 |
|
| 65 |
var rangeIndicator = new CircularRangeIndicator({ |
| 66 |
start: 0, |
| 67 |
value: 65, |
| 68 |
radius: 85, |
| 69 |
startThickness:30, |
| 70 |
endThickness: 30, |
| 71 |
fill:{ |
| 72 |
type: "radial", |
| 73 |
cx: 100, |
| 74 |
cy: 85, |
| 75 |
rx: 85, |
| 76 |
ry: 85, |
| 77 |
colors: [ |
| 78 |
{ offset: 0, color: "FF0000" }, |
| 79 |
{ offset: 0.8, color: "red" }, |
| 80 |
{ offset: 1, color: "#FFFAFA" } |
| 81 |
] |
| 82 |
}, |
| 83 |
stroke: null, |
| 84 |
interactionMode: "mouse" |
| 85 |
}); |
| 86 |
scale.addIndicator("rangeIndicator", rangeIndicator); |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
this.addElement("text", new TextIndicator({ |
| 91 |
indicator: rangeIndicator, x:100, y:75, font: {family: "Helvetica", color: "black", size:"16pt"} |
| 92 |
})); |
| 93 |
|
| 94 |
this.addElement("text2", new TextIndicator({ |
| 95 |
value: "units", x:100, y:82, fill: "#CECECE", font: {family: "Helvetica", color: "#CECECE", size:"5pt"} |
| 96 |
})); |
| 97 |
|
| 98 |
this.addElement("text3", new TextIndicator({ |
| 99 |
value: "0", x:30, y:97 |
| 100 |
})); |
| 101 |
|
| 102 |
this.addElement("text4", new TextIndicator({ |
| 103 |
value: "100", x:170, y:97 |
| 104 |
})); |
| 105 |
} |
| 106 |
}); |
| 107 |
}); |