定时刷新图表
其实这个功能在官方demo上已经有了体现
如:https://echarts.apache.org/examples/zh/editor.html?c=gauge
实际代码只有下面两行,一个定时器,每两秒把数据插入到图表里,这样就做到了定时刷新图表
setInterval(function () {
option.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
myChart.setOption(option, true);
},2000);