FVANCOP / ChartNew.js

MIT License
420 stars 142 forks source link

How to update the pie chart in ChartNew.js? #425

Closed ssureshs21 closed 8 years ago

ssureshs21 commented 8 years ago

Hi I am using ChartNew.js. I want to update the pie chart with animation. I am using line chart with live update. The updateChart(ctx,data,config,true,true) method is working fine. I have tried the same for pie chart but the chart is not getting updating. Then i tried like every refresh creating new Chart(document.getElementById("peak_session").getContext("2d")).Pie(data,options) it is working fine and pie chart animation also gets working, i am removing the canvas from the DOM and recreating but the browser memory keep on increasing. Then I tried like creating var ctx1 = new Chart(document.getElementById("peak_session").getContext("2d")); var ctx2 = new Chart(document.getElementById("current_session").getContext("2d")); globally. Then updating the context (ctx1, ctx2) in every refresh like ctx1.Pie(peak_data,options); ctx2.Pie(session_data,options); Its working fine but the chart is not animating. Could you please any one help to update the pie chart with animation and without memory leak?

FVANCOP commented 8 years ago

Hi,

I did not find any problem with the updateChart function for Pie chart.

See new file in Samples folder : updateChartPie.html

http://fvancop.github.io/ChartNew.js/Samples/updateChartPie.html

To avoid lot of unwanted mails for other followers, please take contact by mail if you need more help.

Regards, François

ssureshs21 commented 8 years ago

Hi François,

Thank you very much for you quick and valuable response.