dheinrichs

Database And A Single Multi-Line Chart

Recommended Posts

 

I am trying to figure out how to display multiple lineson a single chart where the data has been pulled from a sql database.

 

Below is my code where I am displaying 2 separate chars unfortunately I cannotfigure out get 2 lines on one chart.

 

I want to eliminate one of the charts and just have multiple lines on one.

 

 

 

 

<HTML>

<HEAD>

<TITLE>

FusionCharts -

</TITLE>

<!---

You need to include the following JS file, if you intend to embed the chart using JavaScript.

Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer

When you make your own charts, make sure that the path to this JS file is correct. Else, you would get JavaScript errors.

--->

<script LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>

<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>

<style type="text/css">

<!--

body {

font-family: Arial, Helvetica, sans-serif;

font-size: 16px;

}

.text{

font-family: Arial, Helvetica, sans-serif;

font-size: 12px;

}

-->

</style>

<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">

</HEAD>

<!---

'We've included ../Includes/FusionCharts.cfm, which contains functions

'to help us easily embed the charts.

--->

<cfinclude template="../Includes/FusionCharts.cfm">

<BODY>

 

 

 

<p>

<!---

In this example, we show how to connect FusionCharts to a database.

--->

 

 

 

<!--- Generate the chart element --->

<cfset strXML2 = "<chart caption='Trunpike Pump Station' lineColor='000000' canvasBgColor='B7D5E8' canvasBgAlpha='80' bgColor='A8AEB3,D1EEEE' bgAlpha='50'

 

xAxisName='Date and Time' yAxisName='G.P.D X1000' showBorder='2' showValues='0' yAxisMinValue='5' yAxisMaxValue='50' adjustDiv='58' decimalPrecision= '2'>">

 

 

<!--- query raco info --->

 

<cfquery name="qry1" datasource="RACO">

 

SELECT rtuid, date, channelno, curr_read, dailytot

FROM dailySewerChartinfo

WHERE (rtuid = 2)

ORDER BY date

 

 

</cfquery>

 

 

<cfloop query="qry1">

 

 

<cfset date1 = qry1.date>

<cfset dailytot1 = qry1.dailytot>

 

 

 

 

<!--- Generate <set label='..' value='..'/> --->

 

 

 

 

 

<cfset strXML2 = strXML2 & "<set label='#date1#' value='#dailytot1#'/>">

 

</cfloop>

 

 

 

 

 

<!--- Finally, close <chart> element --->

 

<cfset strXML2 = strXML2 & "</chart>">

 

 

 

<!--- Generate the chart element --->

<cfset strXML3 = "<chart caption='Concordia Pump Station' lineColor='000000' canvasBgColor='F0D28D' canvasBgAlpha='80' bgColor='FCAF1E,F5D7A6' bgAlpha='50'

 

xAxisName='Date and Time' yAxisName='G.P.D X1000' showBorder='2' showValues='0' yAxisMinValue='400' yAxisMaxValue='650' adjustDiv='58' decimalPrecision= '2'>">

 

 

<!--- query raco info --->

 

<cfquery name="qry1" datasource="RACO">

 

SELECT rtuid, date, channelno, curr_read, dailytot

FROM dailySewerChartinfo

WHERE (rtuid = 3)

ORDER BY date

 

 

</cfquery>

 

 

<cfloop query="qry1">

 

 

<cfset date1 = qry1.date>

<cfset dailytot1 = qry1.dailytot>

 

 

 

 

<!--- Generate <set label='..' value='..'/> --->

 

 

 

 

 

<cfset strXML3 = strXML3 & "<set label='#date1#' value='#dailytot1#'/>">

 

</cfloop>

 

 

<!--- Finally, close <chart> element --->

 

<cfset strXML3 = strXML3 & "</chart>">

 

 

 

 

 

 

<p> </p>

 

 

 

<cfoutput>#renderChart("../../FusionCharts/Line.swf", "3", strXML2, "3" , 1200, 300, false, false)#</cfoutput>

 

 

<cfoutput>#renderChart("../../FusionCharts/Line.swf", "4", strXML3, "4" , 1200, 300, false, false)#</cfoutput>

 

 

<BR><BR>

</p>

<p> </p>

<p> </p>

 

</CENTER>

 

 

</script>

</BODY>

 

</HTML>

 

 

Share this post


Link to post
Share on other sites

Hi,

 

Welcome to FusionCharts Forum! :)

 

We currently do not have any ready Multi-series chart sample implemented using ColdFusion and FusionCharts XT.

 

However, you can follow the XML format the Multi-series chart currently supports and create a the code for the chart based on the XML format mentioned in the following link.

Ref.- http://docs.fusioncharts.com/charts/contents/?DataFormats/XML/MultiSeries.html

 

Hope this helps. :)

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