Vedmack Report post Posted August 1, 2012 Hi After figuring out that its not a good idea to retrieve an existing chart using jquery I temporary moved to js But now it seems that js got some issue too Here how I check if chart already exists var chartReference = FusionCharts("my_chart_id"); if(chartReference){ FusionCharts("my_chart_id").dispose(); } but sometimes i'm getting "getting Uncaught TypeError: Cannot call method 'destroy' of undefined " in my chrome console pointing me to the FusionCharts("my_chart_id").dispose(); line... How can it be fixed? cause the fact i;m entering the if condition means that chartReference object is not null ---> the chart exists so how should I get rid of it ? Regards, Daniel. Share this post Link to post Share on other sites
Guest Sumedh Report post Posted August 2, 2012 Hi, Could you please try following piece of code? var chartRef = FusionCharts("my_chart_id"); if(chartRef == "myChartId"){ FusionCharts("my_chart_id ").dispose(); }else{ var myChart = new FusionCharts("Column3D.swf","my_chart_id ","500","350","0","1"); myChart.setXMLUrl("data.xml"); myChart.render("chartContainer"); FusionCharts.addEventListener ( "Rendered", function(e,p) { alert(e.sender.id + " chart has rendered!" ); } ) } Share this post Link to post Share on other sites
Vedmack Report post Posted August 2, 2012 if(chartRef == "myChartId"){ ? shouldn't it be if(chartRef == "my_chart_id"){ I mean , where does the myChartId came from ? Thanks.. Share this post Link to post Share on other sites
Guest Sumedh Report post Posted August 2, 2012 Apologies for the typo. It is my_chart_id. var chartRef = FusionCharts("my_chart_id "); if(chartRef == "my_chart_id "){ FusionCharts("my_chart_id ").dispose(); }else{ var myChart = new FusionCharts("Column3D.swf","my_chart_id ","500","350","0","1"); myChart.setXMLUrl("data.xml"); myChart.render("chartContainer"); FusionCharts.addEventListener ( "Rendered", function(e,p) { alert(e.sender.id + " chart has rendered!" ); } ) } Share this post Link to post Share on other sites