After thoroughly investigating your issue, I have successfully found a solution!
Please take a moment to review the following fiddle: http://jsfiddle.net/pxQ4L/
It required delving deep into the code to make it operational.
To begin with, I added a div element in the html where the gauge is connected:
<div style="width:300px;height:300px;left:100px;top:100px" id="gauge">
<br />
</div>
Following that, I configured it like this:
require(["dojox/dgauges/components/grey/CircularLinearGauge"],
function (CircularLinearGauge) {
var myGauge = new CircularLinearGauge({
value: 20,
minimum: 0,
maximum: 150,
majorTickInterval: 25,
minorTickIntervall: 5,
indicatorColor: "#000080", //Zeiger
fillColor: "#FFFFFF"
}, dojo.byId("gauge"));
myGauge.startup();
});
The final steps for creating the gauge are as follows:
require(["dojo/ready", "dijit", "dojox/dgauges/TextIndicator",
"dojox/dgauges/LinearScaler","dojox/dgauges/CircularScale",
"dojox/dgauges/CircularRangeIndicator","dojox/dgauges/CircularValueIndicator"],
function (ready, dijit, TextIndicator, LinearScaler, CircularScale,
CircularRangeIndicator,CircularValueIndicator) {
ready(function () {
var gauge = dijit.registry.byId("gauge"); // ADAPT THIS TO YOUR GAUGE ID
gauge.addElement("background", function(g){
g.createEllipse({
cx: 100,
cy: 100,
rx: 100,
ry: 100
}).setFill("#444444");
});
// The scaler
var scaler = new LinearScaler({
minimum: 0,
maximum: 150,
majorTickInterval: 20,
minorTickInterval: 5
});
var scale = new CircularScale({
scaler: scaler,
originX: 100,
originY: 100,
startAngle: 110,
endAngle: 70,
radius: 70,
labelPosition: "outside",
tickShapeFunc: function(group, scale, tick){
return group.createLine({
x1: tick.isMinor ? 2 : 0,
y1: 0,
x2: tick.isMinor ? 8 : 12,
y2: 0
}).setStroke({
color: tick.isMinor ? "black" : "white",
width: tick.isMinor ? 0.5 : 1
});
}
});
gauge.addElement("scale", scale);
// A value indicator
var indicator = new CircularValueIndicator({
interactionArea: "indicator",
indicatorShapeFunc: function(group){
return group.createPolyline([20, -6, 60, 0, 20, 6, 20, -6]).setFill("black").setStroke("white");
},
value: 50
});
scale.addIndicator("indicator", indicator);
//create green range
var rangeIndicatorGreen = new CircularRangeIndicator({
start: 0,
value: 30,
radius: 62,
startThickness:5,
endThickness: 5,
fill: "green",
interactionMode: "none"
});
scale.addIndicator("rangeIndicatorGreen", rangeIndicatorGreen, true);
//create yellow range
var rangeIndicatoryellow = new CircularRangeIndicator({
start: 30,
value: 70,
radius: 62,
startThickness:5,
endThickness: 5,
fill: "yellow",
interactionMode: "none"
});
scale.addIndicator("rangeIndicatoryellow", rangeIndicatoryellow, true)
//create red range
var rangeIndicatorRed = new CircularRangeIndicator({
start: 70,
value: 100,
radius: 62,
startThickness:5,
endThickness: 5,
fill: "red",
interactionMode: "none"
});
scale.addIndicator("rangeIndicatorRed", rangeIndicatorRed, true);
// Indicator Text"
indicator = gauge._elementsIndex.scale._indicators[0];
var indicatorText = new TextIndicator();
indicatorText.set("indicator", indicator);
indicatorText.set("x", 100);
indicatorText.set("y", 100);
gauge.addElement("indicatorText", indicatorText);
});
});
Best regards, Miriam