Current File : /home/caballoscriollos/public_html/espanol/encuesta/graphs/contents/howfcworksdurl.html
<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FusionCharts Free Documentation</title>
<link rel="stylesheet" href="Style.css" type="text/css" />
</head>
<body>
<table width="98%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr>
<td><h2 class="pageHeader">dataURL Method </h2></td>
</tr>
<tr>
<td valign="top" class="text"><p>In this method, you provide the URL of XML Data Document to FusionCharts. The chart now sends a request for XML data to the specified URL, reads it, parses it and then renders the charts accordingly. The following diagram would help you understand better:</p>
</td>
</tr>
<tr>
<td valign="top" class="text"><img src="Images/dataURLMethod.jpg" class="imageBorder"/></td>
</tr>
<tr>
<td valign="top" class="text"><p>As you can see above, the following steps are involved in this process:</p>
<ol>
<li>You first send the HTML content and SWF file to the end viewer's browser. Along with the SWF, you also tell where the data is to be pulled from. This URL points to your server side scripts which would output the XML data document for the chart.<br/><br/>
Once the SWF is loaded on the end viewer's machine, it sends a request for XML data document to the specified URL.<br />
<br />
</li>
<li>Your server side scripts at this URL now
<ul>
<li>Take in the passed parameters (if any) </li>
<li>Process them </li>
<li>Interact with the database. [ Server side scripts also can use forms or arrays as data source. ]</li>
<li>Get data from data base in native objects like Recordsets, Data Readers etc. </li>
<li>Convert this data into XML format using simple string concatenations or using XML DOM.</li>
<li>Finally write this data to output stream (NOT physically on server). </li>
</ul>
<br />
<li>FusionCharts now accepts this XML data, parses it and finally renders the chart. </li>
</ol>
<p class="highlightBlock">If your <span class="codeInline">dataURL</span> contains special characters like ?, & etc., you need to URL Encode the entire URL. Also, if you want to pass any parameters as part of <span class="codeInline">dataURL</span> to your server side scripts, you'll need to URL Encode the entire <span class="codeInline">dataURL</span>. Example: if you want to provide data URL as <span class="codeInline">Data.asp?id=1&subId=2</span>, it should be provided as <span class="codeInline">Data%2Easp%3Fid%3D1%26subId%3D2</span>.</p> </td>
</tr>
<tr>
<td valign="top" class="text"> </td>
</tr>
<tr>
<td valign="top" class="text"><p>As explained earlier, you need the following elements to build a chart using dataURL method:</p>
<ol>
<li><strong>Chart Container Page </strong>- The page which contains the HTML code to embed and show the chart. This page contains the URL for XML Data Document also.</li>
<li><strong>Chart SWF File</strong></li>
<li><strong>Data Provider Page </strong>- The page which will provide XML Data to FusionCharts. This page outputs ONLY XML and no HTML tags. </li>
</ol></td>
</tr>
<tr> <td valign="top" class="text"> </td> </tr>
<tr>
<td valign="top" class="header">Sample Usage of dataURL method using FusionCharts JavaScript Class receiving data from a pre-built XML document </td>
</tr>
<tr>
<td valign="top" class="codeBlock"><div id="chart1div"><br />
This text is replaced by the chart.<br />
</div><br />
<script type="text/javascript"><br />
var chart1 = new FusionCharts("Column2D.swf", "ChId1", "600", "400", "0", "0");
<strong><br />
chart1.setDataURL("Data.xml");</strong><br />
chart1.render("chart1div");<br />
</script>
</td>
</tr>
<tr> <td valign="top" class="text"> </td> </tr>
<tr>
<td valign="top" class="header">Sample Usage of dataURL method using FusionCharts JavaScript Class receiving data from a server side script file </td>
</tr>
<tr>
<td valign="top" class="codeBlock"><div id="chart1div"><br />
This text is replaced by the chart.<br />
</div><br />
<script type="text/javascript"><br />
var chart1 = new FusionCharts("Column2D.swf", "ChId1", "600", "400", "0", "0");
<strong><br />
chart1.setDataURL("Data.asp");</strong><br />
chart1.render("chart1div");<br />
</script></td>
</tr>
<tr> <td valign="top" class="text"> </td> </tr>
<tr>
<td valign="top" class="header">Sample Usage of dataURL method using FusionCharts JavaScript Class passing parameters to server side script file</td>
</tr>
<tr>
<td valign="top" class="codeBlock"><div id="chart1div"><br />
This text is replaced by the chart.<br />
</div><br />
<script type="text/javascript"><br />
var chart1 = new FusionCharts("Column2D.swf", "ChId1", "600", "400", "0", "0");
<br />
<strong> <span class="codeComment">//To pass parameters, URLEncode the dataURL. Use escape() in JavaScript </span><br />
chart1.setDataURL(escape("Data.asp?id=1&subId=2"));</strong><br />
chart1.render("chart1div");<br />
</script>
<p class="highlightBlock">Since parameter query string passed to the server side script contains characters like ?, & etc. , you need to URL Encode the entire dataURL. For example, if you want to provide data URL as <span class="codeInline">Data.asp?id=1&subId=2</span>, it should be provided as <span class="codeInline">Data%2Easp%3Fid%3D1%26subId%3D2</span>.
In JavaScript you can use <span class="codeInline">escape(dataURL)</span> function. In ASP and ASP.NET pages you can use <span class="codeInline">Server.URLEncode(dataURL)</span> function. In PHP pages you can use <span class="codeInline">urlencode(dataURL)</span> function. </p> </td>
</tr>
<tr>
<td valign="top" class="header"> </td>
</tr>
<tr>
<td valign="top" class="header">Sample Usage of dataURL method using direct HTML Embedding and receiving data from a pre-built XML document </td>
</tr>
<tr>
<td valign="top" class="codeBlock"><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="500" height="300" id="Column2D" align="middle">
<br />
<param name="movie" value="Column2D.swf" /><br />
<strong> <param name="FlashVars" value="&dataURL=Data.xml</strong>&chartWidth=500&chartHeight=300<strong>" /></strong><br />
<param name="quality" value="high" /><br />
<embed src="Column2D.swf" <strong>FlashVars="&dataURL=Data.xml</strong>&chartWidth=500&chartHeight=300<strong>"</strong> quality="high" bgcolor="#ffffff" width="400" height="300" name="Column2D" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br />
</object></td>
</tr>
<tr> <td valign="top" class="text"> </td> </tr>
<tr>
<td valign="top" class="header">Sample Usage of dataURL method using direct HTML Embedding and a server side script as data provider </td>
</tr>
<tr>
<td valign="top" class="codeBlock"><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="500" height="300" id="Column2D" align="middle">
<br />
<param name="movie" value="Column2D.swf" /><br />
<strong> <param name="FlashVars" value="&dataURL=Data.asp</strong>&chartWidth=500&chartHeight=300<strong>" /></strong><br />
<param name="quality" value="high" /><br />
<embed src="Column2D.swf" <strong>FlashVars="&dataURL=Data.asp</strong>&chartWidth=500&chartHeight=300<strong>"</strong> quality="high" bgcolor="#ffffff" width="400" height="300" name="Column2D" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br />
</object></td>
</tr>
<tr>
<td valign="top" class="text"> </td>
</tr>
<tr>
<td valign="top" class="highlightBlock"><span class="codeInline">dataURL</span> method is the recommended method, as it does not place any limits on the size of XML Data. Also, if you're using special characters (UTF-8 or double byte characters) in your XML, you need to necessarily use dataURL method. </td>
</tr>
</table>
</body>
</html>
Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat