User Guide

62 Chapter 5 Graphing Data
Graphing Data
One of the most important considerations when you graph data is the way you
supply the data to the
cfgraph tag. You can supply data in several ways:
Provide all the data in a single query.
Specify individual data points using
cfgraphdata tags.
Combine data from a query with additional data points from
cfgraphdata tags.
Note
The
cfgraph tag graphs numeric data only. As a result, you must convert any dates,
times, or preformatted currency values, such as $3,000.53, to integers or real
numbers.
Graphing a query
When you graph a query, you specify the query name in the cfgraph tag query
attribute. In this format the
cfgraph tag body is empty. However, you must still
provide the
<\cfgraph> end tag. For example, a simple cfgraph tag for a bar chart
might look like this:
<cfgraph type="bar" title="Salaries by Department"
query="DataTable"
itemColumn="Dept_Name"
valueColumn="AvgByDept">
</cfgraph>
This tag displays the values in the AvgByDept column of the DataTable query. It
displays the Dept_Name column value as the item label by each bar. The title
Salaries by Department appears above the chart.
The
cfgraph tag can take the following information from a query:
Attribute Description
query The query containing the data.
valueColumn The query column containing the values to be graphed.
itemColumn (Optional) The query column containing the description for this data
point. The item normally appears on the horizontal axis of bar and
line graphs, on the vertical axis of horizontal bar graphs, and in the
legend in pie charts.