avernet Report post Posted July 7, 2009 I am using FusionCharts 3.1, and set the XML for the chart with JavaScript with the setDataXML() method. It works fine, and the chart shows as expected. Later on the same page, I call the setDataXML() method again to update the chart, and get the JavaScript error "chartObj.setDataXML is not a function". I added some debug code to FusionChart.js, in "else" part of setDataXML(). The variable chartObj correctly points to the object as expected, but setDataXML() is undefined on that object. Any idea of why this would be the case? Alex Share this post Link to post Share on other sites
FusionCharts Support Report post Posted July 7, 2009 Hi, Could you please see whether you have set the RegisterWithJS parameter to "1" ? Share this post Link to post Share on other sites
avernet Report post Posted July 8, 2009 Sudipto Choudhury (7/7/2009)Hi, Could you please see whether you have set the RegisterWithJS parameter to "1" ? That was it! I didn't have the RegisterWithJS=1, and in fact didn't even know about it before reading your message . This the call to setDataXML() goes through and the chart "re-draws", but it isn't updated: even if the data I provide is different, I get exactly the same chart. Any reason why this could be happening? Alex Share this post Link to post Share on other sites
Guest Rajroop Report post Posted July 8, 2009 Hello Alex, Could you please set your Flash Player's Global Security setting and try again? Please see this http://www.fusioncharts.com/forum/FindPost8077.aspx post, this post will guide you how to set your Flash Player Global Security Setting. Hope this helps. Share this post Link to post Share on other sites
avernet Report post Posted July 8, 2009 Rajroop, I am not loading the file locally (as in from c:...); I am loading everything, the swf, HTML, and JavaScript, from http://localhost:8080/. Alex Share this post Link to post Share on other sites
avernet Report post Posted July 8, 2009 A workaround is to just recreate the FusionCharts object every time I need to update it, instead of reusing it. Is there any downside in recreating the FusionCharts object this way? Alex Share this post Link to post Share on other sites
Guest Rajroop Report post Posted July 8, 2009 Hello, In your update chart code simply write: getChartFromId("chart_display").setDataXML(xmlData); or if you have received the response text in URLEncoded form : getChartFromId("chart_display").setDataXML(unesape(xmlData)); Note: You would need to render the chart ONCE bofore you can update it. I hope this helps. Share this post Link to post Share on other sites
avernet Report post Posted July 8, 2009 Rajroop, Ah, you found it: I was calling render() every time after calling setDataXML(), and apparently when doing so the chart renders with the initial data. Like you said, render() must be called once, after the initial call to setDataXML(). Alex Share this post Link to post Share on other sites
Guest Rajroop Report post Posted July 8, 2009 Glad to be of help. Share this post Link to post Share on other sites