User Guide

Table Of Contents
Charting data 741
One use of combining queries and data points is to provide data that is missing from the database;
for example, to provide the data for one department if the data for that department is missing.
The example in the following procedure adds data for the Facilities and Documentation
departments to the salary data obtained from the query shown in the previous section:
To chart a query and individual data points:
1.
Open the chartdata.cfm file in your editor.
2.
Edit the cfchart tag so that it appears as follows:
<cfchart chartwidth="600">
<cfchartseries
type="bar"
query="DeptSalaries"
itemColumn ="Dept_Name"
valueColumn="AvgByDept"
>
<cfchartdata item="Facilities" value="35000">
<cfchartdata item="Documentation" value="45000">
</cfchartseries>
</cfchart>
3.
Save the page as chartqueryanddata.cfm in the myapps directory under the web root directory.
For example, the directory path in Windows might be C:\Inetpub\wwwroot\myapps.
4.
Return to your browser and enter the following URL to view the chartqueryanddata.cfm page:
http://localhost/myapps/chartqueryanddata.cfm
Charting multiple data collections
Sometimes, you might have more than one series of data to display on a single chart, or you want
to compare two sets of data on the same chart. In some cases, you might want to use different
charting types on the same chart. For example, you might want to include a line chart on a bar
chart.
To combine multiple data series into a single chart, insert multiple
cfchartseries tags within a
single
cfchart tag. You control how the multiple data collections are charted using the
seriesPlacement attribute of the cfchart tag. Using this attribute, you can specify the
following options:
default Let ColdFusion determine the best method for combining the data.
cluster Place corresponding chart elements from each series next to each other.
stacked Combine the corresponding elements of each series.
percent Show the elements of each series as a percentage of the total of all corresponding
elements.