0

是否可以像默认的圆形线性仪表一样在经典的圆形线性仪表中显示当前值?

谢谢你。

4

1 回答 1

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 ...

于 2013-04-03T08:45:22.503 回答