I cannot seem to clear the canvas!

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Julie Gong on 27th September 2013
Thank you so much for developing this RGraph.

I am trying to draw pie chart on the canvas, the data is based on user's select pass week, month, or 6 month, and use ajax to get data from server.

it draw beautiful pie chart, but I tried to clear the canvas by using

  var myCanvas = document.getElementById("chartBlk");
        var context = myCanvas.getContext('2d');
        context.fillStyle = 'white';
        context.fillRect(0,0, myCanvas.width, myCanvas.height);

it covered the chart. it will show the chart again as soon as I click the screen.

Posted by Jared B on 27th September 2013
Try RGraph.Reset(); inside the () you will need to put the id of your canvas and it should clear it
Posted by Enter your name... on 28th September 2013
it works. thank you for your help.

Add a reply

« Back to message list