tobyjoiner Report post Posted October 11, 2009 I have been trying to get 2 charts that are basically the same to work in the same page. I can take either one out and the other works fine, but when I have both and I try to run the function on either one of them, it only updates the first one on the page. I am sure I am just missing something easy, but can't find it. These are the 2 functions I use to call get the new chart data. chartdata.php returns xml code, and that looks fine, and like I said above, works fine with either one of the charts. This is in the head section of the page. function changeChart1Date(modDate, modLength) { chart1.setDataURL("chartdata.php?date="+modDate+"&length="+modLength); } function changeChart2Date(modDate, modLength) { chart2.setDataURL("chartdata.php?date="+modDate+"&length="+modLength); } This is in the body and obviously loads the charts to begin with. If I change the data on one of them from here they both work fine, and show separate data. Its just the reload that is broken. The code below is in the body section and has the 2 divs nearby. var chart1 = new FusionCharts("/chart/MSLine.swf", "sampleChart", "650", "300", "0", "1"); chart1.setDataURL("chartdata.php"); chart1.render("chart1div"); var chart2 = new FusionCharts("/chart/MSLine.swf", "sampleChart", "650", "300", "0", "1"); chart2.setDataURL("chartdata.php"); chart2.render("chart2div"); Thanks for any help, Toby Share this post Link to post Share on other sites
Guest Madhumita Report post Posted October 12, 2009 Hello, Welcome to FusionCharts Forum. The issue arose as both the charts had the same id : sampleChart Please consider changing the codes to the following: function changeChart1Date(modDate, modLength) { var chart1 = getChartFromId("sampleChart1"); chart1.setDataURL("chartdata.php?date="+modDate+"&length="+modLength); } function changeChart2Date(modDate, modLength) { var chart2 = getChartFromId("sampleChart2"); chart2.setDataURL("chartdata.php?date="+modDate+"&length="+modLength); } var chart1 = new FusionCharts("/chart/MSLine.swf", "sampleChart1", "650", "300", "0", "1"); chart1.setDataURL("chartdata.php"); chart1.render("chart1div"); var chart2 = new FusionCharts("/chart/MSLine.swf", "sampleChart2", "650", "300", "0", "1"); chart2.setDataURL("chartdata.php"); chart2.render("chart2div"); Hope this helps. Awaiting your reply. Share this post Link to post Share on other sites
tobyjoiner Report post Posted October 12, 2009 That worked perfectly. Good to know these forums have people that respond. Thank you very much Toby Share this post Link to post Share on other sites
Guest Madhumita Report post Posted October 13, 2009 Hello, You are most welcome. We thank you too for appreciating our zeal to help FusionCharters. Happy FusionCharting. Share this post Link to post Share on other sites