Alberto
Members-
Content count
9 -
Joined
-
Last visited
About Alberto
-
Rank
Forum Newbie
-
Dynamically update swf type and data via setDataXML
Alberto replied to Rahul Kumar's topic in Javascript Problems
I went ahead and used your suggestion and that seemed to work just fine. var c = new FusionCharts(swf, "myFirst", chart_myFirst.getAttribute('width'), chart_myFirst.getAttribute('height'), "0", "1"); I used the getAttribute on the existing chart to insure that the sizes were the same. Also, for anyone reading this thread. Do not forget to encode ( escape) your url in setDataUrl Thanks again -
Dynamically update swf type and data via setDataXML
Alberto replied to Rahul Kumar's topic in Javascript Problems
Can I not just use the same js object already created as demonstrated above chart_myFirst.setAttribute("swf",swf); chart_myFirst.render('myFirstDiv'); chart_myFirst.setDataURL(url); I will try with a brand new object -
Dynamically update swf type and data via setDataXML
Alberto replied to Rahul Kumar's topic in Javascript Problems
Ok it seems the path was an issue... now here are the results. chart_myFirst.setAttribute("swf",swf); chart_myFirst.setDataURL(url); chart_myFirst.render('myFirstDiv'); It looks like url is not being sent as I loop through 4 reports and they are all using the same data. So when the report has a swf that matches the data from the initial report the report displays. For example MSLine and MSColumn2d show up since the same data works on both. Again the setDataURL is not working since it displays the same data though it is using the correct swf. When I switch it to say a pie then I get a "No Data To Display". If I comment out the set attribute and render so.. chart_myFirst.setDataURL(url); When this is used then the data is updated but the graph of course is not. Lastly if I change the setDataURL after the render.. like chart_myFirst.setAttribute("swf",swf); chart_myFirst.render('myFirstDiv'); chart_myFirst.setDataURL(url); I get a function setDataURL does not exist. I've been at this for a while as I work on other items, but I hope this is a common issue others are having when dynamically changing graphs in the same graph object. -
Dynamically update swf type and data via setDataXML
Alberto replied to Rahul Kumar's topic in Javascript Problems
Please let me know what other information you need from me to see what I might be doing wrong -
Dynamically update swf type and data via setDataXML
Alberto replied to Rahul Kumar's topic in Javascript Problems
this is initial chart initialization when viewing html source. The div containing the obj is myFirstDiv //Instantiate the Chart var chart_myFirst = new FusionCharts("../classes/fusioncharts/MSLine.swf", "myFirst", "340", "180", "0", "1"); //Set the dataURL of the chart chart_myFirst.setDataURL("index.php%3Ffuse%3Dreports%26indashboard%3D1%26noheaderfooter%3D1%26view%3DViewReport%26report%3DIncome_Growth%26type%3DIncome%26graphdata%3D1") //Finally, render the chart. chart_myFirst.render("myFirstDiv"); -
Dynamically update swf type and data via setDataXML
Alberto replied to Rahul Kumar's topic in Javascript Problems
Thanks for sending me over that example. I have tried the following. chart_myFirst is global and when I run this sending it a swf it does not work. I do not get an js error or warning. Just cleared out the report that was there. If I send without the swf and just url the report updates properly. function updateReport(url,swf) { if(swf!=null){ chart_myFirst.setAttribute("swf",swf); chart_myFirst.setDataURL(url); chart_myFirst.render('myFirstDiv'); }else{ chart_myFirst.setDataURL(url); } } Any ideas? -
Dynamically update swf type and data via setDataXML
Alberto replied to Rahul Kumar's topic in Javascript Problems
Wonderful thanks. I'm going to give it a try now and post the results. -
If I'm doing something like this to update XML or URL how can I also update the chart swf type function updateChart(xml){ var c=getChartFromId('chartId1');//pass your chart's id here in case the id differs c.setDataXML(xml); } I want to also dynamically update the swf from pie to bar etc. Is this possible? I saw an example in the forum that did something like this chart1.setAttribute('swf', 'pathtocharts/charts/' + chartType + '.swf'); chart1.render('chartId1'); Thank you for your help!