Fusionchart cannot re-create chart on FireFox
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Fusionchart cannot re-create chart on FireFox... Expand / Collapse
Author
Message
Posted 5/13/2008 1:05:05 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 9/11/2008 4:09:09 AM
Posts: 5, Visits: 10
I am using php with professional fusionchart. I need re-create chart when user choose value from a select box. My code work as well on IE. But I cannot re-create new chart on FireFox. Firefox always show old chart that it created on the firsttime. I try to  debug javascript and saw that it always call initChart function to re-create chart. But Firefox doesn't have any changed. Please help me to solve it ASAP. I have to fix this bug for my customer.

Here is my code :

<html>
<head>
<title> new document </title>
</head>
<script>
  function onSelectChange() {
         var chartXML ='';
        //get chartXML from server and init chart 
        //...
        //...

        initChart(chartXML);
  }


  function initChart(chartXML) {
     var chart = document.getElementById("chartdiv");     
     chart = new FusionCharts("fusion/Charts/Area2D.swf", "chartdiv", 500, 500, "0", "0");
     chart.setDataXML(chartXML);
     chartXML = '';
     chart.render("chartdiv");
  }
</script>
<body>
<form name="form1">
<select name="chart" onchange="onSelectChange()">
 <option value=1>1</option>
 <option value=2>2</option>
</select>
<table width="100%">
 <tr height="100%">
 <td height="100%" valign="top" class="block" align="center"><div id="chartdiv" style="width:100%;height:100%;"></div></td>
  </tr>
</table>

</form>
</body>


  Post Attachments 
IE_before_and_after_change.JPG (7 views, 30.69 KB)
FireFox_before_and_after_change.JPG (6 views, 34.27 KB)

Post #6248
Posted 5/19/2008 5:25:57 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Today @ 4:19:22 AM
Posts: 885, Visits: 1,422
Hi,

Could you please provide different and unique Div ID and chart ID?

Same id is causing a conflict between the 2 HTML elements ( DIV and <Embed> in FF/<object> in IE) when JavaScript is accessing the DOM. In IE luckly the first Element (the DIV) is updated. So you get to see the chart> While in FF the <embed> Element is getting accessed and the new code for chart is getting appened in the <embed> object itself withour replacing the old <embed> element. So the old chart remains in FF and the new entry is just igonred by FF as nested embed elements is not valid.

So the solution is simply to provide different and unique Div ID and chart ID:

e.g.

     var chart = new FusionCharts("Area2D.swf", "chartId", 500, 500, "0", "0");
     chart.setDataXML(chartXML);
     chart.render("chartdiv");

Regards,

Sudipto Choudhury
FusionCharts Team

Post #6338
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 10:26pm


Execution: 0.063.