gclapp

setDataXML not working IE 6 and 7

Recommended Posts

i've got a chart that needs to get update with some predetermined strings in an array: chartdata[0]="etc"

 

 

 

It's similar to:

 

http://www.fusioncharts.com/FusionCharts/Demos/JS/Index.html

 

 

 

when I click the link to update the chart I get am:

 

 

 

"Object doesn't support this porperty or method".

 

 

 

note that I am no longer relying on any getElementByID and am indeed referencing the chart object itself, in my case called RBChart:

 

 

 

Everything works fine in FireFox bit IE breaks.

 

 

 

Now this is in an ASP.NET site and the element is closed within form tags, I don't know if that's what's killing it.

 

 

 

This is the line that it's breaking on;

 

 

 

}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);

 

}

 

 

 

chartObj is an OBJECT, not an EMBED.

 

 

 

Can anyone help ?

Share this post


Link to post
Share on other sites

yes it's in the middle of an asp.net page so i really have no choice. I thought that getting a reference to the object itself could be enough, so I modified the fusioncharts c# helper to do this...

 

 

 

builder.AppendFormat("chart_{0} = new FusionCharts("{1}

 

 

 

instead of

 

 

 

builder.AppendFormat("var chart_{0} = new FusionCharts("{1}

 

 

 

so that chart_{0} would be a global variable and I could reference it later directly, which I'm able to do.

 

 

 

In a javascript console

 

 

 

chart_RBChart returns an OBJECT so I know I'm getting a correct reference

 

 

 

but

 

 

 

chart_RBChart.setDataXML(XMLData)

 

 

 

still returns an error in IE6 and IE&, but FireFox is OK.

 

 

 

n.

Share this post


Link to post
Share on other sites

In this case too, chart_0 gets you reference to the chart class - but not the actual object (flash object).

When using with ASP.NET, if you intend to update charts on client side, you'll necessarily need to put the chart code outside a FORM tag.

Share this post


Link to post
Share on other sites

that's not going to be possible for me as I'm using a master page which has to have a form tag in it, and all ASP.NET controls need to be inside a form tag.

 

 

 

Do you mean to tell me that we can't update via javascript in a form tag at all ? There is NO workaround ? That makes it impossible to use for most normal ASP.NET pages.

 

 

 

There must be a way to get to the chart object within a form, no ?

Share this post


Link to post
Share on other sites

In the documentation there is a statement that says:

 

 

 

"You must manually get a reference to the chart".

 

 

 

What exactly do I need a reference for, as I am generating the javascritp server side I should be bale to do something.

Share this post


Link to post
Share on other sites

If you're normally using FusionCharts in your ASP.NET pages (i.e, not needing client side JavaScript updates), you can place the charts anywhere in your page - including inside <FORM> elements.

However, if you need to update your chart at the client side, you'll need to put the chart outside <FORM> elements. A work-around was to use second <form></form> tag inside the main <form></form> tags. But, ASP.NET Master pages do not allow for the same, leaving us with no other options.

Share this post


Link to post
Share on other sites

that workaround, using a second form tag may work, as i'm building the html by hand and can manually insert another form tag.

Would that work ? I can make that happen as the inner form tag is geing generated in a string at run time.

 

If so let me know the technique.

Share this post


Link to post
Share on other sites

Yes - you can use something like:

<BODY>
<form id='form1' name='form1' method='post' runat="server">
<form method='post'>
</form>
<div id="chart1div">
  This text is replaced by the Flash movie.
</div>
<script type="text/javascript">
  var chart1 = new FusionCharts("Bar2D.swf", "ChId1", "600", "400", "0", "1");
  chart1.setDataXML("<graph><set name='A' value='22' /> <set name='A' value='22' /></graph>");
  chart1.render("chart1div");
</script>
</form>
</BODY>

Now, you'll be able to access this chart from JavaScript normally.

Share this post


Link to post
Share on other sites

I tried this technique, but found that it ended up effectively disabling any form submit buttion on the page, even when the form was a completely different form.  In our web application, we generate the original code on the fly, and then rely on update panels to update the javascript, but have also had no success.

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