I have to render a number of charts in the same page and the data comes from a MySQL db.
The issue that I have is the page is rendering the same chart twice, instead of 2 different charts.
Here's the XML file that's generated through php:
<chart caption="% Asthma Patients w/ Flu Vaccine" sformatNumberScale='1' syncAxisLimits='1' rotateValues='0' rotateLabels='1' slantLabels='0' showSum='1' numVDivLines='10' vDivLineIsDashed='1' vDivLineDashLen='2' vDivLineDashGap='2' xAxisName='Month' >
<set label="May/2010" value="58"/>
<set label="Jun/2010" value="16"/>
<set label="Jul/2010" value="3"/>
<set label="Aug/2010" value="6"/>
<set label="Sep/2010" value="6"/>
<set label="Oct/2010" value="3"/>
<set label="Dec/2010" value="5"/>
<set label="Jan/2011" value="5"/>
<trendLines>
<line startValue='180' color='009933' isTrendZone='1' displayvalue='' />
</trendLines>
<styles> <definition> <style name='myShadow' type='Shadow' distance='5' angle='45' /> </definition> <application>
<apply toObject='Canvas' styles='myShadow' /> </application> </styles>
</chart>
<chart caption="% Asthma Patients w/ 3 Care Components" sformatNumberScale='1' syncAxisLimits='1' rotateValues='0' rotateLabels='1' slantLabels='0' showSum='0' numVDivLines='10' vDivLineIsDashed='1' vDivLineDashLen='2' vDivLineDashGap='2' xAxisName='Month'>
<set label="May/2010" value="55"/>
<set label="Jun/2010" value="17"/>
<set label="Jul/2010" value="4"/>
<set label="Aug/2010" value="4"/>
<set label="Sep/2010" value="4"/>
<set label="Oct/2010" value="6"/>
<set label="Dec/2010" value="7"/>
<set label="Jan/2011" value="5"/>
<trendLines>
<line startValue='180' color='009933' isTrendZone='1' displayvalue='' /> </trendLines>
<styles> <definition> <style name='myShadow2' type='Shadow' distance='5' angle='45' /> </definition> <application> <apply toObject='Canvas' styles='myShadow2' /> </application> </styles>
</chart>
The above code when seeing in a browser gives me the following error:
XML Parsing Error: junk after document element
Location: http://staging.ncahec.net/roles/ipip/dataChartXML.php
Line Number 21, Column 21: </styles></chart><chart caption="% Asthma Patients w/ 3 Care Components" sformatNumberScale='1'
and points to the second opening <chart> tag.
Here's how I'm calling these:
var myChart = new FusionCharts( "../../includes/Charts/Line.swf", "myChartId", "700", "400", "0", "1" );
myChart.setXMLUrl("dataChartXML.php");
myChart.configure("RenderingChartText", "Rendering chart. Please wait");
myChart.render("asthmaChart1");
var myChart2 = new FusionCharts( "../../includes/Charts/Line.swf", "myChartId2", "700", "400", "0", "1" );
myChart2.setXMLUrl("dataChartXML.php");
myChart2.configure("RenderingChartText", "Rendering chart. Please wait");
myChart2.render("asthmaChart2");
And I have the two divs that render the charts
<div id="asthmaChart1"></div>
<div id="asthmaChart2"></div>
I was successful implementing this using two separate XML files.
I'm wondering what's the way to do this using only one single XML files, otherwise I'll have to generate tons of XML files (one for each chart).
Thanks.