Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Zingchart to refresh

Tags:

zingchart

We use socket library to download data from our service. I am doing the following the send this data to zingchart (after massaging of data):

myChart.series[0].values.push([xVal, yVal]); // index 0 is hard coded for demo

The charts don't refresh though. We would like them to feel like real-time.

like image 760
shunya Avatar asked Mar 17 '23 19:03

shunya


1 Answers

ZingChart doesn't have two-way data-binding so modifications to the data object after render won't take affect.

However, ZingChart does have a pretty killer API. If you're trying to append values to the series, try the appendseriesvalues method. It should look something like this...

zingchart.exec("your_chart_id", "appendseriesvalues", {
    values: [xVal,yVal]
});

If you're trying to simulate real-time, you could even toss it in a setInterval function and have it request data regularly.

I work on the ZingChart team. Let me know if you need any more help.

like image 173
Patrick RoDee Avatar answered May 16 '23 08:05

Patrick RoDee