简体   繁体   English

如何使用anychart制作实时量表?

[英]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.

相关问题 动画在Android中的AnyChart Circluar量表中不起作用 - Animation not working in AnyChart Circluar Gauge chart in Android 我已经使用这种 xmlhttprequest 方法来制作显示水质但不起作用的实时仪表图? - I've used this xmlhttprequest approach to be able to make a real-time gauge chart that shows water quality but not working? 如何同时输出仪表图和折线图实时数据,问题出在server.php页面? - How can I output gauge chart and line chart real-time data at the same time, problem is in server.php page? 如何更改Anychart水平仪中的标记标签? - How to change marker labels in anychart horizontal gauge? 如何使用 Anychart.js 将动态 Object Arrays 显示到图表中 - How to display Dynamic Object Arrays into chart using Anychart.js 如何在不使用anychart下载的情况下获取图表作为图像? - How to get chart as image without download it using anychart? 如何使用d3制作实时多线图,其中数据来自json格式的api - how to make real time multi line chart using d3 where data is from api in json format 如何使用anychart js在下拉值函数中显示图表中的数据? - How to display data in a chart in function of dropdown value using anychart js? Anychart:如何在AnyChart7.1的饼图或漏斗图中添加动画 - Anychart : How to add animation in Pie or funnel chart of AnyChart7.1 使Google Chart Gauge具有响应性 - Make Google Chart Gauge responsive
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM