FusionCharts Forum: Can't get XML data to load - FusionCharts Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Can't get XML data to load Found SWF object, apparently can't find the XML file

#1 User is offline   archfiend997 

  • Forum Newbie
  • Group: Members
  • Posts: 5
  • Joined: 30-March 10

Posted 30 March 2010 - 01:48 PM

Hello,



I'm trying to do the most simple implementation of a Fusion chart. I followed directions from the documentation, creating the XML file, and inserting the object and embed tags into the view. All the other methods (dataXML and JavaScript) don't work at all. I'm assuming I must have Rails 2.2.2 for these to work as shown in their examples in the "Using with RoR" section. I get errors, and for now I'm stuck with Rails 2.1.0, so I'm just trying to do the basic method as shown in the "Creating your First Chart" section.



As with RoR, I put the SWF objects in the /public/fusion_charts folder. Next I made the example XML file, which was confirmed to have no errors or typos, and I put that in the same folder as the view within which the chart should be loaded. So my view is located at /app/views/example/index.rhtml. The XML file is located at /app/views/example/Data.xml, just like the documentation said. The RHTML page loads, the SWF object loads, but I get "Invalid XML format". The XML is _exactly_ the same as the one in the example, e.g., "Monthly Sales Summary".



My HTML:

http://pastie.org/895704



If I change the file to look for, from Data.xml to say, Data2.xml, which does not exist at all, I still get "Invalid XML format", and not "Error in Loading Data", which according to the documentation, should be the message I get.



So basically despite that I'm getting the wrong error message, I think it just can't find the XML file. Any other RoR developers had this problem? I'm clueless as to what I'm doing wrong...



Thanks in advance!
0

Other Replies To This Topic

#2 User is offline   archfiend997 

  • Forum Newbie
  • Group: Members
  • Posts: 5
  • Joined: 30-March 10

Posted 30 March 2010 - 04:14 PM

I think I got it!



I ended up using the setDataURL method as shown in the "Basic Examples" of the "Using With Ruby on Rails" part of the documentation.



The is a CRITICAL missing character in the example code the documentation provided!



The doc has this code:




<% @page_title="FusionCharts - Simple Column 3D Chart" %>

<% @page_heading="Examples" %>

<% @page_subheading="Basic example using pre-built Data.xml" %>

<%

#Create the chart - Column 3D Chart with data from Data/Data.xml

render_chart_html '/FusionCharts/FCF_Column3D.swf', '/Data/Data.xml', '', 'myFirstHTML', 600, 300 do-%>

<% end -%>





There is no equals character '=' right after the % in the line where the chart is rendered! It should be:


<%=

#Create the chart - Column 3D Chart with data from Data/Data.xml

render_chart_html '/FusionCharts/FCF_Column3D.swf', '/Data/Data.xml', '', 'myFirstHTML', 600, 300 do-%>





Notice the = sign right after the first %. This is what tells Rails that this code should be applied in the view, and not just computed in the background. I can't believe the authors of the documentation forgot this!



Hope this helps some lost Rails developers using FusionCharts.
0

Other Replies To This Topic

#3 User is offline   srividya_sharma 

  • Supreme Being
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 943
  • Joined: 01-October 07

Posted 31 March 2010 - 04:27 AM

Hi

I am not sure why you are facing this problem.

All our examples use <% render_chart_html  and not <%=

and the samples work fine.

If you are using Rails < 2.2 then you could try the examples from FusionCharts Free, which have not been upgraded tp rails 2.2

Please try them out.

thanks :)

Srividya

regards,
Srividya Sharma
0

Other Replies To This Topic

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic