mfreake Report post Posted March 21, 2012 In my javascript code I am dynamically creating divs and appending charts to them using jQuery based on user actions. The user can also cause the charts to be removed. I'm doing this like so (where this._chartsDiv is a jQuery object containing a parent div for all charts to be put in and xml is a local variable containing the chart xml data): var chart = $("<div>"); this._chartsDiv.append(chart); chart.insertFusionCharts({ swfUrl: "Charts/StackedColumn2D.swf", width: "300", height: "250", wMode: "transparent", dataFormat: "xml", dataSource: xml }); I also sometimes update an existing chart like so: this._chartsDiv.children().eq(i) .updateFusionCharts({ dataSource: xml }); My problems occur while trying to remove charts: this._chartsDiv.children().eq(i).remove(); If I quickly try to add and remove charts I will usually get the following error (where the ID is some form of chartobject-X): try { document.getElementById("chartobject-1").SetReturnValue(__flash__toXML(FC_Rendered("chartobject-1")) ); } catch (e) { document.getElementById("chartobject-1").SetReturnValue("<undefined/>"); } It would be very difficult for me to set IDs on the divs or the charts and guarantee they are unique, so I'm hoping there's a solution that doesn't involve that. I'm also wondering if it's because there is no way to destroy or dispose of a chart through jQuery, is that possibly the problem? Is calling the javascript dispose method possible given that the chart is created through jQuery? Thank you. Share this post Link to post Share on other sites
Guest Bindhu Report post Posted March 22, 2012 Hi, Welcome to the FusionCharts Forum. Thank you for the post. You are right there is no equivalent method of dispose() method in jQuery. I am afraid, the chartIds have to be unique or you have to call dispose() method before using the same chartId, since there is no equivalent of dispose() method in jQuery you are compelled to use unique Ids. Hope this helps! Share this post Link to post Share on other sites