| Developing ColdFusion Applications
|
|
Graphing Data
|
Creating a Graph
The cfgraph tag provides five graph types. A large number of attributes let you customize the graph appearance to meet your needs.
Graph types
You can create the following types of graphs:
- Bar
- Horizontal bar
- Line
- Area (a line graph with the area below the line filled in)
- Pie
The following illustrations show one sample of each type of graph:
Creating a basic graph
You use the following cfgraph attributes to create a basic graph:
| Attribute |
Description |
type
|
Must be one of the following values: bar, horizontalbar, pie, or line. (An area graph is a kind of line graph.)
|
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, and in pie charts.
|
You must end your cfgraph tag with a </cfgraph> end tag.
For example, if you have a query that contains average salary by department, the following tag displays a bar graph with the information:
<cfgraph type="bar"
query="DataTable"
valueColumn="AvgByDept"
itemColumn="Dept_Name">
</cfgraph>
The resulting graph looks like this:
Later sections in this chapter provide information on how you can specify the data differently and how you can change and enhance graph appearance.
|
Copyright © 2001, Macromedia Inc. All rights reserved. |
|
|