Updating Fusion Chart Data via setDataXML in IE

by timvasil 1/3/2008 2:42:00 AM

FusionCharts is using Adobe's ExternalInterface API to communicate between JavaScript and the SWF chart when you use FusionCharts.js to do things like setDataXML. For some reason, ExternalInterface isn't working correctly on IE under some conditions; the method simply doesn't exist on the OBJECT element.  I happen to be using the ExtJS library with GWT; either framework may be doing some DOM manipulations under the covers that are freaking out Adobe--but I haven't verified this.

A couple things to try:

  1. Ensure that the ID and name attributes of the OBJECT and/or EMBED tags do not have characters such as . (period), -, +, *, /, and \.  Amusingly, this is because Adobe's ExternalInterface API is using a bunch of eval() JavaScript methods and these special characters get interpreted as JavaScript operators.  Yeah, great work, Adobe.
     
  2. Hook up the ExternalInterface functions you need manually.  For example, here's the modified setDataXML function in FusionCharts.js to do the trick (code in red has been added):

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);
        //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'));
        if (!chartObj.setDataXML)
        {
            __flash__addCallback(chartObj, "setDataXML");
        }
        chartObj.setDataXML(strDataXML);
    }
},

Tags:

JavaScript | FusionCharts

Comments (2) -

10/24/2008 12:30:10 PM

korebantic

I have no idea how much debugging time you just saved me, but I totally owe you a couple of beers.

korebantic United States

1/15/2009 8:28:28 AM

algorista

Very thanks.
You saved me a lot of time.

algorista Brazil

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading


Search

Calendar

«  May 2012  »
SuMoTuWeThFrSa
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

Recent comments

Archive