Home Forums Chart Support redraw chart Reply To: redraw chart

#4860

@umustaphax,

While creating a dynamic chart, to redraw a chart, you will just have to change/add the dataPoints to the dataPoints array and then call chart.render() again.

Please take a look at the code snippet below,

var xVal = dps.length + 1;
var yVal = 100;	
var updateInterval = 1000;
 
var updateChart = function () {
	
	
		yVal = yVal +  Math.round(5 + Math.random() *(-5-5));
		dps.push({x: xVal,y: yVal,});
		
		xVal++;
	
	chart.render();		
 
};
setInterval(function(){updateChart()}, updateInterval); 

Please refer to this documentation page for a step-by-step tutorial on how to create a dynamic chart.

dynamic line chart