chartjs-plugin-streaming
chartjs-plugin-streaming copied to clipboard
Scroll faster that plotting
I am passing the timestamp of the data in the x value in each update.
...options..
realtime: {
delay: 1000,
refresh: 4,
duration: 20000,
ttl: 60000,
pause: false,
onRefresh: (chart) => {
this.addData(chart)
}
}
...
//this.tmpData is an array populated by websocket messages
...methods...
addData(chart) {
let obj = { x: this.tmpData[0].timestamp, y: this.tmpData[0].ecg };
chart.data.datasets[0].data.push(obj);
}
...
The problem is that the chart scroll is faster than the data plotted.