You are viewing documentation for an older version. For current documentation - click here.

Throughout this section, we have shown you how to build charts using static data (that is, data which was manually created by you). However, FusionCharts XT can also connect to dynamic sources of data using server side scripts like ASP, ASP.NET C#, ASP.NET VB.NET, PHP, J2EE, Ruby on Rails, ColdFusion etc.

FusionCharts XT can be implemented using any server-side technology, since charts are rendered at client side. The role of server-side scripts is only to provide XML/JSON data as string.

To make the task of embedding charts in web pages easier, FusionCharts XT provides wrapper classes for various server-side scripts like ASP, ASP.NET C#, ASP.NET VB.NET, PHP, J2EE, Ruby on Rails and ColdFusion. Moreover, in ASP and PHP, the APIs allow you to connect to arrays and databases and even dynamically build XML data which can directly be provided to chart.

In this page, we provide highlights of code snippets that are used in various server-side technologies for embedding FusionCharts XT. The next section shows how charts can be generated using dynamic data from database.

Using ASP
Call renderChart("../../FusionCharts/Column3D.swf", "Data/Data.xml", "", "myFirst", 600, 300, False, True)

Code to create JavaScript chart:

FC_SetRenderer( "javascript" )
Call renderChart("../../FusionCharts/Column2D.swf", "Data/Data.xml", "", "chart1", 600, 300, False, True)

Read more from here on FusionCharts XT and ASP. For more details, please read the Using with ASP and FusionCharts ASP Class sections in the Guide for Web Developers section.

Using ASP.NET C#
FusionCharts.RenderChart("../FusionCharts/Column3D.swf", "Data/Data.xml", "", "myFirst", "600", "300", false, true);

Code to create JavaScript chart:

FusionCharts.SetRenderer("javascript");
Literal1.Text = FusionCharts.RenderChart("../FusionCharts/Column2D.swf", "Data/Data.xml", "", "chart1", "600", "300", false, true); 

Read more from here on FusionCharts XT and ASP.NET C#. For more details, please read the Using with C# (ASP.NET) section in the Guide for Web Developers section.

Using ASP.NET VB
FusionCharts.RenderChart("../FusionCharts/Column3D.swf", "Data/Data.xml", "", "myFirst", "600", "300", False, True)

Code to create JavaScript chart:

FusionCharts.SetRenderer("javascript")
Literal1.Text = FusionCharts.RenderChart("../FusionCharts/Column2D.swf", "../BasicExample/Data/Data.xml", "", "chart1", "600", "300", False, True)

Read more from here on FusionCharts XT and ASP.NET VB. For more details, please read the Using with VB.NET (ASP.NET) section in the Guide for Web Developers section.

Using PHP
renderChart("../../FusionCharts/Column3D.swf", "Data/Data.xml", "", "myFirst", 600, 300, false, true);

Code to create JavaScript chart:

FC_SetRenderer( "javascript" );
echo renderChart("../../FusionCharts/Column2D.swf", "Data/Data.xml", "", "chart1", 600, 300, false, true); 

Read more from here on FusionCharts XT and PHP. For more details, plaese read the Using with PHP and FusionCharts XT PHP Class sections in the Guide for Web Developers section.

Using J2EE
<jsp:include page="../Includes/FusionChartsRenderer.jsp" flush="true">
     <jsp:param name="chartSWF" value="../../FusionCharts/Column3D.swf" />
     <jsp:param name="strURL" value="Data/Data.xml" />
     <jsp:param name="strXML" value="" />
     <jsp:param name="chartId" value="myFirst" />
     <jsp:param name="chartWidth" value="600" />
     <jsp:param name="chartHeight" value="300" />
     <jsp:param name="debugMode" value="false" />
     <jsp:param name="registerWithJS" value="true" />
</jsp:include>

Code to create JavaScript chart:

<fc:render chartId="${chartData.chartId}" swfFilename="${folderPath}${chartData.swfFilename}" 
width="${chartData.width}" height="${chartData.height}" debugMode="false" 
registerWithJS="true" xmlUrl="${chartData.url}" renderer="javascript"/>

Read more from here on FusionCharts XT and J2EE. For more details, plaese read the Using with J2EE section in the Guide for Web Developers section.

Using ColdFusion
<cfoutput>#renderChart("../../FusionCharts/Column3D.swf", "Data/Data.xml", "", "myFirst", 600, 300, false, true)#</cfoutput>

Read more from here on FusionCharts XT and ColdFusion. For more details, please read the Using with ColdFusion section in the Guide for Web Developers section.

Using Ruby on Rails
render_chart '/FusionCharts/Column3D.swf', 'Data/Data.xml', '', 'configuredChart', 600, 300, false, true 

Code to create JavaScript chart:

View:
<%
 #Create the chart - Column 3D Chart with data from Data/Data.xml
 render_chart '/FusionCharts/Column3D.swf', '/Data/Data.xml', '', 'chart1', 
 600, 300, false, true, {:renderer=>"javascript"} do-%>
<% end -%>

Read more from here on FusionCharts XT and RoR. For more details, plaese read the Using with RoR section in the Guide for Web Developers section.

Apart from embedding chart in web applications, some of the server-side-scripts also help in exporting the chart into image/pdf. You can know more on this from Exporting as Image/PDF > Server Side Exporting section. For scripts that do not support server side exporting, you can always use the client side Export handlers.