I've googled till I'm blue in the face, read this forum from cover to cover, but like a lot of folk I'm having an issue trying to get setDataXML to work.
Here's the relevant chunks of my code:
var chartObj;
function calculateLoan_RateMargin() {
... blah ...
new Ajax(url, {
data: {
... blah ...
onComplete: function(response){
$('calculating_loan').hide();
if (response != '') {
json = Json.evaluate(response);
if (json['errors'] != '') {
alert("Error: " + json['errors']);
}
else {
... blah...
//var chartObj = getChartFromId("Pie2D1");
chartObj.setDataXML(json['chart']);
}
}
}
}).request();
}
window.addEvent('domready', function(){
var chart_Pie2D1 = new FusionCharts("components/com_fabrik/plugins/visualization/fusionchart/FCcharts/FCF_Pie2D.swf","Pie2D1", "300", "300", "0", "1", "","noScale","EN");
chartObj = chart_Pie2D1;
//Provide entire XML data using dataXML method
chart_Pie2D1.setDataXML("");
chart_Pie2D1.render("Pie2D1Div");
});
My Pie2D1Div is not inside a form. I'm setting RegisterWithJS. The AJAX call returns correct XML.
But no matter what I try, when I call setDataXML, these two lines:
var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));
chartObj.setDataXML(strDataXML
... inside your setDataXML always return a chartObj which is the embed element, not the actual chart object, so the call fails because the setDataXML method doesn't exist.
As you can see from my code, I've tried the getChartFromId method, and copying the original object to my own variable.
I'm beating my brains out on this one, any help much appreciated.
-- hugh