我正在尝试来自http://dojotoolkit.org/reference-guide/1.8/dojox/widget/AnalogGauge.html#speedometer-style-gauge-with-arc-indicator-and-needle-indicator的一个简单示例 最初不是工作,因为它找不到 dijit。我正在尝试的代码如下( <head > 之后的代码段)
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.3/dijit/themes/claro/claro.css" media="screen">
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.js"></script>
<meta charset="utf-8">
<script>
dojoConfig = {
parseOnLoad : true
}
</script>
<script>
dojo.require("dojox.widget.AnalogGauge");
dojo.require("dijit.Dialog");
dojo.require("dojox.widget.gauge.AnalogArcIndicator");
dojo.require("dojox.widget.gauge.AnalogNeedleIndicator");
dojo.ready(function() {
var gauge = dijit.byId('speedo');
// Used for a gradient arc indicator below:
var fill = {
'type' : 'linear',
'x1' : 50,
'y1' : 50,
'x2' : 350,
'y2' : 350,
'colors' : [{
offset : 0,
color : 'black'
}, {
offset : 0.5,
color : 'black'
}, {
offset : 0.75,
color : 'yellow'
}, {
offset : 1,
color : 'red'
}]
};
gauge.addIndicator(new dojox.widget.gauge.AnalogArcIndicator({
'value' : 200,
'width' : 20,
'offset' : 150,
'color' : fill,
'noChange' : true,
'hideValues' : true
}));
gauge.addIndicator(new dojox.widget.gauge.AnalogArcIndicator({
'value' : 80,
'width' : 10,
'offset' : 150,
'color' : 'blue',
'title' : 'Arc',
'hover' : 'Arc: 80'
}));
gauge.addIndicator(new dojox.widget.gauge.AnalogNeedleIndicator({
'value' : 100,
'width' : 8,
'length' : 150,
'color' : 'red',
'title' : 'Needle',
'hover' : 'Needle: 100'
}));
});
</script>
</head>
<body class="claro">
<div data-dojo-type="dojox.widget.AnalogGauge"
id='speedo'
width="450"
height="300"
cx="225"
cy="175"
radius="150"
startAngle="-135"
endAngle="135"
useRangeStyles="0"
hideValues="true"
color: "white"
majorTicks="{length: 10, offset: 105, interval: 10, color: 'gray'}"
minorTicks="{length: 5, offset: 105, interval: 5, color: 'gray'}">
<div data-dojo-type="dojox.widget.gauge.Range"
low="0"
high="100"
color="{'color': 'black'}"></div>
<div data-dojo-type="dojox.widget.gauge.Range"
low="100"
high="200"
color="{'color': 'black'}"></div>
</div>
</body>
从浏览器控制台窗口中,我可以找到以下错误“Uncaught TypeError: Cannot read property "'_Gauge"' of undefined dojo”。但是我无法找到出错的地方。请为此提供一些帮助。