Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 990

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
Charting individual data points
When you chart individual data points, you specify each data point by inserting a
tag body. For example, the following code creates a simple pie chart:
cfchartseries
<cfchart>
<cfchartseries type="pie">
<cfchartdata item="New Vehicle Sales" value=500000>
<cfchartdata item="Used Vehicle Sales" value=250000>
<cfchartdata item="Leasing" value=300000>
<cfchartdata item="Service" value=400000>
</cfchartseries>
</cfchart>
This pie chart displays four types of revenue for a car dealer. Each
department and a description for the legend.
Note: If two data points have the same item name, ColdFusion creates a graph of the value for the last one specified within
the
tag.
cfchart
The
tag lets you specify the following information about a data point:
cfchartdata
Attribute
Description
The data value to chart. This attribute is required.
value
item
(Optional) The description for this data point. The item appears on the horizontal axis of bar and line charts, on
the vertical axis of horizontal bar charts, and in the legend of pie charts.
Charting a query
Each bar, dot, line, or slice of a chart represents data from one row/column coordinate in your result set. A related
group of data is called a chart series.
Because each bar, dot, line, or slice represents the intersection of two axes, craft the query result set such that the row
and column values have meaning when displayed in a chart. Often, doing so requires you aggregate data in the query.
You typically aggregate data in a query using one of the following:
• Specify a SQL aggregate function (SUM, AVG, MAX, and so on) using a GROUP BY clause in the SELECT
statement.
• Use a Query of Queries.
• Retrieve data from a view, instead of a table.
When you chart a query, you specify the query name using the
example, the code for a simple bar chart could be as follows:
<cfchart
xAxisTitle="Department"
yAxisTitle="Salary Average"
>
<cfchartseries
type="bar"
query="DataTable"
valueColumn="AvgByDept"
itemColumn="Dept_Name"
/>
</cfchart>
cfchartdata
attribute of the
query
Last updated 1/20/2012
tag in the
cfchartdata
tag specifies the income for a
tag. For
cfchartseries
985

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents