Home Forums Chart Support redraw chart

redraw chart

Viewing 5 posts - 1 through 5 (of 5 total)
  • #4859

    hi,
    i need the function in canvasjs to redraw a dynamic chart with multiple data-series.
    thank you.

    #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

    #5230

    I cant make it work with the doughnut chart at all.
    Take a look at my tests:
    https://cabanapps.com.br/valores-vale/TESTS/

    It only changes the colors of the graphics, not the values.
    What I am doing is setting:
    chartTwitter.options.data[0].dataPoints = [my new dataPoints]
    and calling
    chartTwitter.render();

    If I do like in the example:

    Creating Dynamic Charts


    Just updating the dataPoints variable array, nothing happens.

    Any help?

    Besides that, I couldnt manage to creat charts runtime, instead of using “onLoad”.
    It looks like that the way it search for the canvas context get messes up if you dont use onload.
    Do you have any workable example that dont use “onload” event to create the chart?

    #5231

    Oops, forget about the redraw part.
    Just got it to work.
    But can I animate the redrawing process, as if it was being created for the first time?

    #5232

    As of now animation is supported only for Pie Charts – during first render. For other charts it isn’t available yet.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.