国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

js實(shí)現(xiàn)圓盤記速表

2019-11-20 11:56:36
字體:
供稿:網(wǎng)友

如何利用AmCharts制作的汽車速度計(jì)速表,通過設(shè)置不同的速度(數(shù)字)來動(dòng)態(tài)改變計(jì)速表的指針

效果圖:

javascript代碼:

var chart = AmCharts.makeChart("chartdiv", {        "type": "gauge",        "theme": "none",        "axes": [{          "axisThickness": 1,          "axisAlpha": 0.2,          "tickAlpha": 0.2,          "valueInterval": 20,          "bands": [{            "color": "#84b761",            "endValue": 90,            "startValue": 0          }, {            "color": "#fdd400",            "endValue": 130,            "startValue": 90          }, {            "color": "#cc4748",            "endValue": 220,            "innerRadius": "95%",            "startValue": 130          }],          "bottomText": "0 km/h",          "bottomTextYOffset": -20,          "endValue": 320        }],        "arrows": [{}]      });      window.onload=function(){        chart.arrows[0].setValue(80);        chart.axes[0].setBottomText(80  " km/h");      }      document.getElementById("btnSure").onclick=function(){        if(document.getElementById("txtNum").value>320){          alert("超出最大值");          return;        }        if(document.getElementById("txtNum").value<0){          alert("不能低于0");          return;        }        chart.arrows[0].setValue(document.getElementById("txtNum").value);        chart.axes[0].setBottomText(document.getElementById("txtNum").value  " km/h");      }

引入JS:

<script type="text/javascript" src="amcharts.js"></script> <script type="text/javascript" src="gauge.js"></script><script type="text/javascript" src="none.js"></script>

以上就是本文的全部內(nèi)容,希望大家喜歡。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 潢川县| 义马市| 洛阳市| 响水县| 顺平县| 衡阳县| 始兴县| 油尖旺区| 东乡县| 新巴尔虎左旗| 宜宾市| 丹巴县| 长治县| 闽清县| 吕梁市| 博客| 高唐县| 和田市| 台山市| 大化| 周口市| 澄迈县| 隆昌县| 沈阳市| 亳州市| 大城县| 万州区| 高唐县| 洞口县| 蓬莱市| 宿迁市| 兴隆县| 历史| 万宁市| 常州市| 屏东县| 玉田县| 五河县| 竹溪县| 夏邑县| 兰溪市|