buratino Report post Posted February 17, 2007 I need my chart data to be dynamically changed. To update chart data next code is used: var chartObj = getChartFromId(chartToUpdateId); chartObj.setDataXML(newDynamicData); But here is what is going on: chartObj returned by getChartFromId is a function! and thus cannot have setDataXML method... Please help. Where is a mistake? What is wrong here? Thanks in advance. Share this post Link to post Share on other sites
Pallav Report post Posted February 19, 2007 getChartFromId method returns a reference to the Flash Object in the DOM Model. What error are you getting? Also, can you make sure that your chart is NOT inside a FORM? Share this post Link to post Share on other sites
buratino Report post Posted February 19, 2007 Yeah it is not inside a form... The error is: "chartObj.setDataXML is not a function [break on this error] chartObj.setDataXML(newDynamicData);" Share this post Link to post Share on other sites
Pallav Report post Posted February 20, 2007 Which SWF file are you using? Also, can you please host the page live so that we can debug? Share this post Link to post Share on other sites
buratino Report post Posted February 26, 2007 I use Area2D and Chart2D but it looks like the error occurs for both of them. The page is deployed for debug. Please let me know if you received a link and successfully signed in. Thank you very much. Appreciating your help. Share this post Link to post Share on other sites
Pallav Report post Posted February 27, 2007 Can you please send us the link? Share this post Link to post Share on other sites
buratino Report post Posted February 27, 2007 Hi, here is the link https://213.130.16.232/financial/graph/dashboard Please log in as 'lohika', password - 'test'. It is part of a comercial project that is why link is given privately. On the page there is a chart with no data set on its creation(that is '') Then javaScript slider component is created for this chart. Slider has event that is triggered on slider position changing (and after slider initialization). This event in our case calls function that updates graph data. The function has to send AJAX request but i simplified that for debugging purposes and simply some stub data is set into the chart. Actually it is no set because error occurs on setDataXml method call. Javascript breaks its execution and i even cannot move the slider For now as a workaround i recreate chart every time the data has to be updated but what is bad is that chart is blinking on being recreated. Please let me know if i can somehow assist in solving this problem... If you have any questions feel free to ask (more detail explanation on our JavaScript or any other).. Thank you very much for you help. P.S.: It looks like Email button under the posts on this forum doesn't work.. Share this post Link to post Share on other sites
Pallav Report post Posted February 27, 2007 I'm unable to open the given URL. We did receive your email and replied that we're unable to open the URL. Share this post Link to post Share on other sites
minkey Report post Posted March 9, 2007 Im getting a similar problem, and its coming from the example from the download. From CodeJavaScriptBasicsChangeDataXML.html it errors out in Firefox and IE. When you try to change the data, nothing happens and in firefox the error chartObj.setDataXML is not a function is returned. It errors out in IE also. Ive tried it with the developer package and the evaluation package and I get the error in both packages. Share this post Link to post Share on other sites
someone1 Report post Posted March 11, 2007 Has a solution to this been found? I have a similar problem and thought maybe that it had to do with other javascript files i had included. I use the prototype.js framework/library and thought it might be interfering with fusion charts extensions of javscript's prototype Share this post Link to post Share on other sites
Pallav Report post Posted March 12, 2007 Can you make sure that you Share this post Link to post Share on other sites
minkey Report post Posted March 12, 2007 the example works when run from a webserver. Unfortunately, I still have the problem when I try to populate with my actual web page. I have a JBOSS server running struts. The javascript on the struts page fills data dynamically, but I always get teh cartObj has no properties when I fill it. I have a page, that initializes the chart with blank data. I use Yahoo YUI widgets which calls the init function after the page is loaded. In the init function, it runs a dwr call to get data. when data come back, i use setDataXML to fill the chart. (Im just using a set string to populate to test). I still get chartObj has no properties. I have something like this: function init(){ setTimeout("Budget.getChartData(getChartDataReturn)",1500); } YAHOO.util.Event.addListener(window, "load", init); function getChartDataReturn(data){ if(data != null){ var chartObj = getChartFromId("chartdiv"); chartObj.setDataXML(""); } } var myChart = new FusionCharts("${staticServer}/Charts/Doughnut2D.swf", "myChartId", "900", "300", "0", "0"); myChart.setDataXML(""); myChart.render("chartdiv"); Share this post Link to post Share on other sites
minkey Report post Posted March 12, 2007 Im doing all those except the registerWithJS flag set to 1 Im following the examples you have that change XML with javacsript and I didnt see that flag being set anywhere. Share this post Link to post Share on other sites
minkey Report post Posted March 12, 2007 Ive don it this way, I still get the error, this is embedded in the JSP so its not a static server error. After init it called, the chart is rendered with No Data. When FC_Rendered is called, I get the chartObj error. function init(){ var myChart = new FusionCharts("${staticServer}/Charts/Doughnut2D.swf", "myChartId", "900", "300", "0", "1"); myChart.setDataXML(""); myChart.render("chartdiv"); } YAHOO.util.Event.addListener(window, "load", init); function FC_Rendered(domId){ if (domId=="chartdiv"){ var chartObj = getChartFromId(domId); chartObj.setDataXML(""); } return true; } Share this post Link to post Share on other sites
Pallav Report post Posted March 13, 2007 The init function should be called from FC_Rendered. window.load occurs much before the chart is loaded - as the chart is a streaming SWF file. When the chart is loaded, FC_Rendered method is called - there, you need to call init(). Share this post Link to post Share on other sites
minkey Report post Posted March 13, 2007 The init function is initializing the chart with blank data. I try to put data in the chart when its loaded with the FC_Rendered function. Isnt FC_Rendered called automatically after the chart is loaded? function init(){ var myChart = new FusionCharts("${staticServer}/Charts/Doughnut2D.swf", "myChartId", "900", "300", "0", "1"); myChart.setDataXML(""); myChart.render("chartdiv"); } YAHOO.util.Event.addListener(window, "load", init); function FC_Rendered(domId){ if (domId=="chartdiv"){ var chartObj = getChartFromId(domId); chartObj.setDataXML(""); } return true; } Share this post Link to post Share on other sites
Pallav Report post Posted March 14, 2007 Also, please make the following change: function FC_Rendered(domId){ if (domId=="myChartId"){ var chartObj = getChartFromId(domId); chartObj.setDataXML(""); } return true; } Share this post Link to post Share on other sites
minkey Report post Posted March 15, 2007 Ah, that was my problem, that fixed it, thanks. Now I have another question When i call the chart through Javascript like that, how do i set: Share this post Link to post Share on other sites
minkey Report post Posted March 15, 2007 figured it out, thanks Share this post Link to post Share on other sites
funktifyknow Report post Posted March 29, 2007 (edited) @someone1 prototyping only creates a new object. the prototype library should in no way interfere with the prototype method of this architecture. Edited March 29, 2007 by Guest Share this post Link to post Share on other sites