FusionCharts Support

Angular Gauges don't work if rendered first with ' in XML

Recommended Posts

If I pass angular gauges XML data via setDataXML containing "'" before calling render(), the chart will break and not work even when passed data not containing "'".

 

 

 

If I pass data without "'", render it, and then setDataXML containing "'", it renders as expected.

Share this post


Link to post
Share on other sites

As far as I can tell, the Angular gauges in particular have a bug where you must not use ' for the initial rendering, but you must use it for subsequent renderings.

 

 

 

This is a major bug for me because determining which escaping method to use adds a bunch of non-intuitive ugly code to my app.

 

 

 

Any chance you can release a point release of FusionCharts that handles escaping in a consistent manner?

Share this post


Link to post
Share on other sites

Hi,

Initially FusionCharts JS Class passes the XML (as dataXML) and other settings to the angular gauge or any other widget or chart as a simple querystring. Since & acts as a separator for querystring variables the presence of & in dataXML would break it. While updating the already rendered chart, the XML is passed as a string to the chart directly thorugh an exposed function of the chart. Hence, that wont break.

What you can do is modify FusionCharts.js to suit your need:

 

setDataXML: function(strDataXML){

  //If being set initially

if (this.initialDataSet==false){

  //This method sets the data XML for the chart INITIALLY.

  this.addVariable('dataXML',strDataXML.replace(/&/g,"%26");

  //Update flag

  this.initialDataSet = true;

  }else{

  //Else, we update the chart data using External Interface

//Get reference to chart object

  var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));

  chartObj.setDataXML(strDataXML);

  }

},

 

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