Sign in to follow this  
cheesegrits

More setDataXML problems

Recommended Posts

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

Share this post


Link to post
Share on other sites

Just FYI, the initial call to setDataXML (inside the domReady function) does have valid XML data, it just got removed when posting, presumably phpBB not liking the chevron tags.

 

 

 

Also, just in case it is relevant, I'm using Mootools 1.2, which is where the domReady event and the Ajax call are handled.

 

 

 

And ... the initial chart render in the domReady works like a charm.

 

 

 

-- hugh

Edited by Guest

Share this post


Link to post
Share on other sites

OK, I just found some other responses to this issue explaining that the setDataXML() method is not exposed to JS in the free version. Don't know how I missed that on my first pass through this forum, I must be going blind.

 

 

 

So I'm working round it by just re-rendering the chart after each AJAX call.

 

 

 

Works fine.

 

 

 

Thanks for an awesome product!

 

 

 

-- hugh

Share this post


Link to post
Share on other sites
Guest Rajroop

Hi Hugh,

You are most welcome! :)

Glad to have shown you the way. Now, you must walk towards that direction! :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this