I have a little demo web page that had five buttons on it (Column2D, Column3D, Pie2D, Pie3D, Line). In the past, I have been able to click any button and have the swf change based on which button I clicked. This allowed me to see the same data in 5 different forms.
Today, I decided that I was going to add a Multi Series 3D Column button to the page. Obviously, I would need to load a special XML file for this button due to the fact that the syntax is a little different. However, now I notice that when I click on the Multi Series button I get a JavaScript error that says the object doesn't support the property/method.
Here is the function that I have been using to switch my swf:
function switchChartType(chartType)
{
chart1.setAttribute('swf', 'http://marks/FusionCharts/charts/' + chartType + '.swf');
chart1.render('mainChart');
}
chartType is passed in as the name of the actual SWF that is saved on my machine.
Here is the function that I am using to switch my data sources:
function switchSource(toFile)
{
chart1 = getChartFromId("main_chart");
if(toFile == "True")
chart1.setDataURL("/exampleChart.xml");
else
chart1.setDataXML(xmlData);
}
toFile indicates whether or not the chart should be loaded from a file (for the Multi-Series chart) or from JavaScript (for the other charts).
For the record, chart1 and xmlData are both global.
The code seems to error when I call chart1's render function. However, this only occurs when the Multi-Series chart is involved. If it is removed, everything is fine. Any thoughts?