Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 1005

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
Code
SUM(Salary) AS SumByDept,
<cfset
DeptSalaries.SumByDept[i]=Round(DeptSalari
es.SumByDept[i]/ 1000)*1000>
<cfchart
tipStyle="mousedown"
font="Times"
fontsize=14
fontBold="yes"
backgroundColor = "##CCFFFF"
show3D="yes"
>
<cfchartseries
type="pie"
query="DeptSalaries"
valueColumn="SumByDept"
itemColumn="Dept_Name"
colorlist="##6666FF,##66FF66,##FF6666,##66
CCCC"
/>
Creating an area chart
The example in the following procedure adds an area chart to the salaries analysis page. The chart shows the average
salary by start date to the salaries analysis page. It shows the use of a second query of queries to generate a new analysis
of the raw data from the GetSalaries query. It also shows the use of additional
Open the chartdata.cfm file in your editor.
1
Edit the GetSalaries query so that it appears as follows:
2
<!-- Get the raw data from the database. -->
<cfquery name="GetSalaries" datasource="cfdocexamples">
SELECT Departmt.Dept_Name,
Employee.StartDate,
Employee.Salary
FROM Departmt, Employee
WHERE Departmt.Dept_ID = Employee.Dept_ID
</cfquery>
Add the following code before the
3
Description
In the DeptSalaries query, add a SUM aggregation function to get the sum of all
salaries per department.
In the cfloop tag, round the salary sums to the nearest thousand.
Show a tip only when a user clicks the chart, display text in Times bold font, set the
background color to light blue, and display the chart in three dimensions.
Create a pie chart using the SumByDept salary sum values from the DeptSalaries
query.
Use the contents of the Dept_Name column for the item labels displayed in the
chart legend.
Get the pie slice colors from a custom list, which uses hexadecimal color numbers.
The double number signs prevent ColdFusion from trying to interpret the color
data as variable names.
tag:
html
Last updated 1/20/2012
attributes.
cfchart
1000

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents