populate FusionCharts with XML data AJAX
Posted
by Mick
on Stack Overflow
See other posts from Stack Overflow
or by Mick
Published on 2009-11-15T12:14:45Z
Indexed on
2010/05/07
19:38 UTC
Read the original article
Hit count: 323
Hi I have a js file that uses ajax to get a XML doc from a php script . The XML file forms the data to draw a Fusion Chart. I know I am getting the XML data ok but FusionCharts will not draw it . I would really appreciate any help , thanks
(FusionCharts.js is included earlier in my script)
if(XMLHttpRequestObject) {
XMLHttpRequestObject.open("GET", "chart.php?job="+job, true);
XMLHttpRequestObject.onreadystatechange = function() {
if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
var xdoc = XMLHttpRequestObject.responseXML;
var chart1 = new FusionCharts("Pie3D.swf", "chart1Id", "400", "300", "0", "1");
chart1.setDataXML(xdoc);
chart1.render("chart1div");
chart.php produces this XML data
<chart caption='ADI Chart Test ' >
<set label='Driver' value='12.25' />
<set label='Other Staff' value='223.21' />
<set label='Equipment' value='0.00' />
<set label='Additional Items' value='0.00' />
<set label='Vehicle Fuel' value='0.00' />
<set label='Accomodation' value='0.00' />
<set label='Generator Fuel' value='0.00' />
</chart>
© Stack Overflow or respective owner