Dojo儀錶盤,dojo入門

來源:互聯網
上載者:User

Dojo儀錶盤,dojo入門

Dojo提供了非常好的儀錶盤顯示,效果如下:


<!DOCTYPE html><html><head>    <title>Dojo儀錶盤</title>    <meta charset="utf-8">    <script src="http://192.168.240.186/arcgis_js_api/library/3.6/init.js"></script>    <script type="text/javascript">        var publicVariable=12;        require(["dojox/dgauges/GaugeBase",            "dojox/dgauges/components/default/CircularLinearGauge",            "dojox/dgauges/components/classic/SemiCircularLinearGauge",            "dojox/dgauges/components/classic/HorizontalLinearGauge",            "dojox/dgauges/components/default/VerticalLinearGauge",            "dojo/dom",            "dojo/domReady!"        ],        function(            GaugeBase,            CircularLinearGauge,//圓形儀錶            SemiCircularLinearGauge,//半圓形儀錶            HorizontalLinearGauge,//橫向刻度尺            VerticalLinearGauge,//縱向刻度尺            dom)        {            var watch1 = new CircularLinearGauge(//圓形儀錶                {                    value:publicVariable,                    animationDuration:1000                },                dom.byId("watch1")            );            var watch2 = new SemiCircularLinearGauge(//半圓形儀錶                    {                        value:publicVariable,                        animationDuration:1000                    },                    dom.byId("watch2")            );            var watch3 = new HorizontalLinearGauge(//橫向刻度尺                    {                        value:publicVariable,                        animationDuration:1000                    },                    dom.byId("watch3")            );            var watch4 = new VerticalLinearGauge(//縱向刻度尺                    {                        value:publicVariable,                        animationDuration:1000                    },                    dom.byId("watch4")            );            setInterval(TriggerBackendData, 2000);            function TriggerBackendData(){                var value=GetRandomNum(0, 100);                watch1.set("value", value);                watch1.refreshRendering();                watch2.set("value", value);                watch2.refreshRendering();                watch3.set("value", value);                watch3.refreshRendering();                watch4.set("value", value);                watch4.refreshRendering();            };        });        function GetRandomNum(Min,Max)        {            var Range = Max - Min;            var Rand = Math.random();            return(Min + Math.round(Rand * Range));        }    </script></head><body><div id="watch1" style="width:200px;height:200px" ></div><br /><div id="watch2" style="width:200px;height:200px" ></div><br /><div id="watch3" style="width:600px;height:50px; position: absolute; top: 50px; left: 500px;" ></div><br /><div id="watch4" style="width:50px;height:600px; position: absolute; top: 10px; left: 300px;" ></div><br /></body></html>





聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.