Sign in to follow this  
mchacks

Fusionchart.js Issue

Recommended Posts

I have an ajax call to update the chart. The call works fine and returns XMLDocument. But when checking through IE F12, the script Fusionchart.js seems to throw the following..

 

SCRIPT438: Object doesn't support property or method 'toString' 
FusionCharts.js, line 135 character 73

 

I recently downloaded the trial version.

 

Just to clarify.. Here is my chart render code..

 

fusionChart.Text = FusionCharts.RenderChart("../_layouts/FCharts/Pie3d.swf", "", xmlStr.ToString(), "myTasks", "400", "300", false, true);

Here is my Ajax call..

$.ajax({
       	type: 'POST',
       	url: strURL,
       	data: "{}",
       	datatype: "xml",
       	contentType: "application/xml; charset=utf-8",
       	success: function (data) {
           	var chartObj = getChartFromId("myTasks");
           	chartObj.setDataXML(data);
       	}
   	});

 

Can someone tell me what needs to be done to fix this?

Share this post


Link to post
Share on other sites

Hi,

 

Can you paste your sample code here?

 

Other than what I have shared above, the other relevant things are here..

 

The WebMethod in asmx

[WebMethod, ScriptMethod(ResponseFormat=ResponseFormat.Xml)]
   	public XmlDocument GetFusionChartData()
   	{
       	try
       	{
           	WebPartModel wpm = new WebPartModel();
           	XmlTextReader xtr = new XmlTextReader(new StringReader(wpm.GetFusionChartData().ToString()));
           	XmlDocument sendXML = new XmlDocument();
           	sendXML.Load(xtr);
           	return sendXML;
       	}
       	catch (Exception ex)
       	{

           	Logger logger = new Logger();
           	logger.WriteException(ex, "GetFusionChartData", SPContext.Current.Web.CurrentUser);
           	throw ex;
       	}
   	}

 

And it returns

<?xml version="1.0" encoding="utf-8"?>
<chart caption="My Task Status" showBorder="1" baseFont="Arial" baseFontSize="10" outCnvBaseFontSize="12" bgColor="FFFFFF" paletteColors="47985E,F1AB65,8FB61B" pieRadius="100" enableSmartLabels="0">
 <set label="This week" value="1" />
 <set label="Overdue" value="0" />
 <set label="Today" value="0" />
 <styles>
<definition>
 	<style name="myValues" type="font" size="10" borderColor="000000" bgcolor="FFFFFF" leftMargin="10" letterSpacing="1" />
 	<style name="myCaption" type="font" font="Futura" size="12" bold="0" align="left" />
</definition>
<application>
 	<apply toObject="DataLabels" styles="myValues" />
 	<apply toObject="Caption" styles="myCaption" />
</application>
 </styles>
</chart>

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Could you please confirm the followings?

 

1. Whether you have included the "FusionCharts.js" file in your *.aspx page

 

2. Included the InfoSoftGlobal namespace provided in FusionCharts.dll which provides FusionCharts class (FusionCharts class provides static methods to create charts) and added reference of FusionCharts.dll in your project

 

Awaiting your response !

Share this post


Link to post
Share on other sites

Hi,

 

Could you please confirm the followings?

 

1. Whether you have included the "FusionCharts.js" file in your *.aspx page

 

2. Included the InfoSoftGlobal namespace provided in FusionCharts.dll which provides FusionCharts class (FusionCharts class provides static methods to create charts) and added reference of FusionCharts.dll in your project

 

Awaiting your response !

 

Yes.. All of the above are included.(Its actually an ascx file)

Edited by mchacks

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

Could you please try by using "FusionCharts()" instead of "getChartFromId()" and "setXMLData()" instead of "setDataXML" as these are the deprecated methods?

 

 

 

Share this post


Link to post
Share on other sites

Hi,

 

Could you please try by using "FusionCharts()" instead of "getChartFromId()" and "setXMLData()" instead of "setDataXML" as these are the deprecated methods?

 

 

 

 

Tried.. Same error.

Share this post


Link to post
Share on other sites

We have gone through several iteration of code sharing and it has not reached anywhere. So instead of me sharing code, could you guys give me a working code of how to reload fusion chart based on an Ajax call (similar to code that I have shared earlier).

 

Hi,

 

Could you please paste your entire JavaScript code here?

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

We are not able to replicate any issue with the ASP.NET C# and Ajax call.

 

Please find the attached illustration and screen-shots for your reference.

post-24802-0-70641000-1347275580_thumb.png

post-24802-0-10278000-1347275595_thumb.png

FCXT_Ajax.zip

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