Code
<cfloop index="i" from="1"
to="#HireSalaries.RecordCount#">
<cfset HireSalaries.AvgByStart[i]
=Round(HireSalaries.AvgByStart[i]
/1000)*1000>
</cfloop>
<cfchart
chartWidth=400
BackgroundColor="##FFFF00"
show3D="yes" >
<cfchartseries
type="area"
query="HireSalaries"
valueColumn="AvgByStart"
itemColumn="StartDate"
/>
</cfchart>
Setting curve chart characteristics
Curves use the attributes already discussed. However, you should be aware that curve charts
require a large amount of processing to render. For fastest performance, create them offline, write
them to a file or variable, then reference them in your application pages. For information on
creating offline charts, see
Linking charts to URLs
ColdFusion provides a data drill-down capability with charts. This means you can click on an area
of a chart, both the data and the legend areas, to request a URL. For example, if you have a pie
chart and want a user to be able to select a pie wedge for more information, you can build that
functionality into your chart.
You use the
url
anywhere on the chart. For example, define a chart that opens the page moreinfo.cfm when a user
clicks on the chart using the following code:
<cfchart
xAxisTitle="Department"
yAxisTitle="Salary Average"
url="moreinfo.cfm"
>
<cfchartseries
seriesLable="Department Salaries"
...
/>
</cfchart>
You can use the following variables in the
target page:
•
The value of the selected item, or an empty string
$VALUE$
•
$ITEMLABEL$
•
$SERIESLABEL$
636
Chapter 28: Charting and Graphing Data
"Writing a chart to a variable" on page
attribute of the
cfchart
The label of the selected item, or an empty string
The label of the selected series, or empty string
Description
Round the salaries to the nearest thousand.
Create a line chart using the HireSalaries query.
Chart the average salaries against the start date.
Limit the chart width to 400 pixels, show the chart in
3-D, and set the background color to white.
tag to specify the URL to open when a user clicks
attribute to pass additional information to the
url
627.
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers