TheKamakaZi

setDataXML vs. setDataURL issue

Recommended Posts

Hi Guys

I quite possibly have the biggest head scratcher on my hands. When I construct all my XML data into a variable (in ASP) and try to render the chart (FCF_MSColumn3D.swf, in this case) using setDataXML, I get "Chart." ok, fine, something's not happy.

BUT! When I view the source code of the processed page and copy the setDataXML contents into an XML file exactly as it appears in the source code, and use setDataURL, it renders fine!

Could someone tell me what on earth is going on?

The source code (HTML):

<!-- START Script Block for Chart MonthlyStats -->
 <div id='MonthlyStatsDiv' align='center'>
 Chart.

 </div>

 <script type="text/javascript"> 
 //Instantiate the Chart 
 var chart_MonthlyStats = new FusionCharts("FusionCharts/FCF_MSColumn3D.swf", "MonthlyStats", "900", "300");

 //Provide entire XML data using dataXML method 
 chart_MonthlyStats.setDataXML("<graph xaxisname='Months' yaxisname='Totals' hovercapbg='DEDEBE' hovercapborder='889E6D' rotateNames='0' yAxisMaxValue='100' numdivlines='9' divLineColor='CCCCCC' divLineAlpha='80' decimalPrecision='0' showAlternateHGridColor='1' AlternateHGridAlpha='30' AlternateHGridColor='CCCCCC' caption='Monthly Statisics'>   <categories font='Arial' fontSize='11' fontColor='000000'>	  <category name='Jan 2008' />	  <category name='Dec 2007' />	  <category name='Nov 2007' />	  <category name='Oct 2007' />	  <category name='Sep 2007' />	  <category name='Aug 2007' />	  <category name='Jul 2007' />	  <category name='Jun 2007' />	  <category name='May 2007' />	  <category name='Apr 2007' />	  <category name='Mar 2007' />	  <category name='Feb 2007' />   </categories>   <dataset seriesname='Unique Visitors' color='FDC12E'>
  <set value='8' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />   </dataset>   <dataset seriesname='Total Visits' color='56B9F9'>	  <set value='12' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />   </dataset>   <dataset seriesname='Total Page Views' color='56B9F9'>	  <set value='16' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />	  <set value='0' />   </dataset></graph>");

 //Finally, render the chart.
 chart_MonthlyStats.render("MonthlyStatsDiv");
 </script> 
 <!-- END Script Block for Chart MonthlyStats -->

I tried tried formatting the data with vbCrLf's as well, but with the same results.

Please help!

Share this post


Link to post
Share on other sites

hi,

 

please do not use vbCrLf nay where when you use dataXML.Because that will terminate the string in javaScript and if you turn on the SCript Debugging in IE or see Error Console in Firefox etc. you will find the error : Unterminated String Cionstant.

Share this post


Link to post
Share on other sites

Hi Sudipto

Thanks for the advice. I'll make sure i don't use it i the future. Do you know what the limit on the size of the string is that i can pass from ASP to JS? I ask, because even with vbCrlf removed, it still extends the string over 2 lines...

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