是否可以在classic circular linear gauge中显示default circular linear gauge中的当前值?
谢谢。
答案 0 :(得分:3)
更改test_Classic_CircularLinearGauge.html内的脚本标记:
<script type="text/javascript">
require(["dojo/_base/kernel","dojo/parser","dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dojox/dgauges/components/classic/CircularLinearGauge"]);
</script>
要:
<script type="text/javascript">
require(["dojo/_base/kernel","dojo/parser","dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dojox/dgauges/components/classic/CircularLinearGauge"]);
// ADD THE CURRENT VALUE TO INDICATOR
require(["dojo/ready","dijit","dojox/dgauges/TextIndicator"],function(
ready,dijit,TextIndicator){
ready(function(){
var gauge=dijit.registry.byId("g1"); // ADAPT THIS TO YOUR GAUGE ID
indicator=gauge._elementsIndex.scale._indicators[0];
var indicatorText=new TextIndicator();
indicatorText.set("indicator",indicator);
indicatorText.set("x",80);
indicatorText.set("y",150);
gauge.addElement("indicatorText",indicatorText);
});
});
</script>
这有点肮脏,坚韧。更好的方法是从CircularLinearGauge创建自己的类,并在构造函数中添加TextIndicator ......