[英]how to make real time gauge chart using anychart?
I use node.js and javascript for creating a program. 我使用node.js和javascript创建程序。
I want to create a real time gauge using anychart, but the anychart gauge chart doesn't change although the data is coming from socket.io. 我想使用anychart创建一个实时量表,但是anychart量表的图表没有变化,尽管数据来自socket.io。
I want to access the anychart gauge chart object and change the data that was received from the socket. 我想访问anychart仪表图对象并更改从套接字接收的数据。
How can I solve this problem? 我怎么解决这个问题?
anychartObj = new RealTimeAnyChart(elementId);
chartArrayList.push(anychartObj);
function RealTimeAnyChart(elemntId){
this.dataSet = anychart.data.set([15]);
this.gauge = anychart.gauges.circular();
this.gauge.data(this.dataSet);
this.gauge.container(elementId);
this.gauge.draw();
}
socket.on(' ',function(){
chartArrayList.gauge = value ?? this part is problem..
}
You can create new dataSet and apply it to you circular gauge like this: 您可以创建新的dataSet并将其应用到圆形量规,如下所示:
socket.on(' ',function(){
var newData = anychart.data.set([20]);
chartArrayList.gauge.data(newData);
}
If you have an access to the existing dataSet object you can apply new data right to the old dataSet and do not create a new one. 如果您有权访问现有的dataSet对象,则可以将新数据直接应用于旧的dataSet,而无需创建新的dataSet对象。 You can achieve that like this:
您可以这样实现:
dataSet.data([20]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.