Sign in to follow this  
Atom

Making a chart without a data.xml file

Recommended Posts

I posted this in another area of the forum and got no response, so I hope someone here can explain.

When you go through the process of "creating your first chart" you are given some code to embed which includes a reference to the location of the data. It is this line...

 

param name="Flashvars" value="&dataURL=Data.xml"

 

Now, you can leave this line of code completely out and the chart will run just the same. Or, you can include the line and give the file a different name.

 

My first question is, how does the script know where to get the data for the chart if you don't explicitly tell it? Secondly, how do you go about creating two separate charts from two completely different sets of data on the same web page?

 

 

Atom

Share this post


Link to post
Share on other sites

Hello,

The chart does need to be pointed to the source data explicitly. That line <param name="FlashVars" value="&dataURL=Data.xml&chartWidth=900&chartHeight=300"> is used to set the size of the chart explicitly, so that browsers which recognize the object tag also renser the chart correctly. For example, IE sometimes does not send the width/height specifications, and that line would prevent any errors.

Also, multiple charts can be put on the same page as described in the following documentation: http://www.fusioncharts.com/docs/Contents/MultipleCharts.html

Now, this uses just one data surce. Hoever, all one needs to do is make two XML files, and associate them explicitly! It is that simple. :)

Eg-

...

myChart1.setDataURL("Data1.xml");

...

myChart2.setDataURL("Data2.xml");

...

etc.

I hope this helps! :)

Share this post


Link to post
Share on other sites

Thanks for your reply, but if the data must be pointed to explicitly then why am I able to generate a chart with only this code...

<html>
<head>
<title>My First FusionCharts</title>
</head>
<body bgcolor="#ffffff">
<center>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" 
width="600" height="300" id="Column3D" >
<param name="movie" value="../FusionCharts/Column3D.swf" />
</object>
</center>
</body>
</html>

Share this post


Link to post
Share on other sites

On a related matter, the exact code which runs a chart on my website is thus;

<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','600','height','300','src','Line','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','Line' ); //end AC code
</script>
<noscript>
<center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"
width="600" height="300"> <param name="movie" value="Line.swf"
/> <param name="quality" value="high" /> <embed
src="Line.swf" quality="high"
pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash" width="600"
height="300"></embed> </object> </center> </noscript>

There is, of course, no reference to a data.xml file here either, but I would also point out that the chart will run just fine without

everything between the noscript tags.  The purpose of this code is to avoid having to be prompted by IE to allow the code to be generated. 

You don't seem to mention this anywhere.  Comments?

Share this post


Link to post
Share on other sites

OK, here's what the code should look like.

<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','600','height','300','src','Line','FlashVars','&dataURL=Data.xml','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','Line','FlashVars','&dataURL=Data.xml' ); //end AC code
</script>
<noscript><center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"
width="600" height="300"> <param name="movie" value="Line.swf"
/> <param name="quality" value="high" />
<param name="FlashVars"
value="&dataURL=Data.xml&chartWidth=600&chartHeight=300">
<embed src="Line.swf"
flashVars="&dataURL=Data.xml&chartWidth=600&chartHeight=300"
quality="high"
pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash" width="600"
height="300"></embed> </object> </center> </noscript>

 

At least it works:)

Share this post


Link to post
Share on other sites

What problems can result from having the html and the data in the same folder?  And, if having them in the same folder is undesireable, why does it run at all without any file pointing when the data is in the same folder? 

Share this post


Link to post
Share on other sites

No problems will arise out of it, as such. Just that, only one data source can be produced thus, because only one file in a folder may be called Data.xml :)

(In many situations there are more than one charts on a page, drawing data from various sources)

Share this post


Link to post
Share on other sites

Ok, I get that, but you still didn't explain why you can generate a chart without pointing to any data file as long as there is a data.xml file in the same folder as the html you are calling the chart from.

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