Sign in to follow this  
ChartsJazz

setDataXML error

Recommended Posts

FusionCharts v.3 Enterprise, Classic ASP with JavaScript

.asp includes FusionCharts.asp and FusionCharts.js

Chart is rendered in the .asp with

Call renderChartHTML("FusionCharts/Charts/COLUMN3D.swf", "", strXML, "myChart", intChartWidth, intChartHeight, false)

This works. 

Now when I try to update the chart from a JS function using setDataXML:

function updateChart(DOMId){ 
   var myChart = getChartFromId("myChart");
   alert(myChart.id);
   myChart.setDataXML("<chart><set label='B' value='12' /><set label='C' value='10' /><set label='D' value='18' /><set label='E' value='21' /></chart>");
} 

  alert(myChart.id); 

returns "myChart" which is correct even though the chart is inside

 <form></form> 

tags.

I hard-coded the strXML data for testing to eliminate other possible problems.  (I used the value from one of the FusionCharts doc pages.)

The last line of the function, starting with "myChart.setDataXML," returns a JS error:  "Object does not support this property or method."

What am I doing wrong?

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

If you've your chart objects inside <FORM> elements, you CANNOT use getChartFromId() method to get a reference to the chart, as the DOM Hierarchy of the chart object has changed. You'll get a JavaScript "<<ChartId>> is undefined" error. In these cases, you'll manually need to get a reference to the chart object. Or, you can opt to place the chart object outside <FORM> element.

Share this post


Link to post
Share on other sites

As I explained, I do not get the "<<ChartId>> is undefined" error.  The statement that gets the ID does not fail.  The alert returns the chart object ID.  The problem is not in getting the chart object ID.  The problem is with the setDataXML method, which returns "Object does not support this property or method."

Share this post


Link to post
Share on other sites

Can the client-side JavaScript method setDataXML be used to update the chart when the chart was originally rendered with the server-side VBScript statement

Call

renderChartHTML

or does the chart have to have been originally rendered with client-side JavaScript for the setDataXML method to work?

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

 

 

 

You can update the chart at client-side using getChartFromId("myId").setDataXML() even after the chart was originally rendered using serverside methods.

 

Note: That RegisterWithJS parameter must be set to true.

Share this post


Link to post
Share on other sites

The RegisterWithJS parameter is not valid on the server when the chart is created with Call renderChartHTML.  How do I set that parameter in the client-side JavaScript without creating a new chart with JavaScript?

 

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

RegisterWithJS parameter is valid on server. Please consider setting it to 1 when you are rendering it client-side.

 

 ref. -  RenderChartHTML("chartSWF", "strURL", "strXML", "myFirst", "600", "300", debugMode,registerWithJS);

 

Share this post


Link to post
Share on other sites

renderChartHTML only accepts 7 parameters.  When I try to add an 8th param, whether I set it to 1 or "1" or true or "true" the browser displays:

Microsoft VBScript runtime (0x800A01C2)

Wrong number of arguments or invalid property assignment: 'renderChartHTML'

 

Share this post


Link to post
Share on other sites

This is disturbing that FusionCharts now has a .dll.  One reason I advised the company I work for to buy FusionCharts is that it had no .dll and all I needed to copy to the web server was FusionCharts.asp, FusionCharts.js, and the .swf files for the chart types I wanted to use.  The contract I work on does not allow us to install .dlls on the web server.  We are developing in Classic ASP, which does not get compiled and does not use any .dlls.

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

The FusionCharts.dll file is used ASP.NET.

When using classic ASP you do not require to use it.

In classic ASP the registerWithJS parameter is not included.

However, you can include it in the following manner:

 RenderChartHTML("chartSWF?registerWithJS=1", "strURL", "strXML", "myFirst", "600", "300", debugMode);

 

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

I am extremely apologetic for the inconvenience.

But glad that your issue has been resolved.

Happy FusionCharting. :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