User Guide

Controlling Graph Appearance 73
Reviewing the code
The following table describes the highlighted code and its function:
Code Description
SUM(Salary) AS SumByDept,
In the DeptSalaries query, add a SUM
aggregation function to get the sum of all
salaries per department.
<cfset DeptSalaries.SumByDept[i]=
Round(DeptSalaries.SumByDept[i]/
1000)*1000>
In the cfloop, round the salary sums to
the nearest thousand.
<cfgraph type="pie"
query="DeptSalaries"
valueColumn="SumByDept"
Create a pie graph using the SumByDept
salary sum values from the DeptSalares
query.
itemColumn="Dept_Name"
Use the contents of the Dept_Name
column for the item labels displayed in the
chart legend.
title="Total Salaries by
Department"
titleFont="Times"
Put a title above the graph.
Format it in Times font.
showvalue="rollover"
valueLabelFont="Times"
Display the data value, in Times font, only
when the user points to a pie slice.
borderWidth = 0
Do not put a border around the chart
backgroundColor = "##CCFFFF"
colorList = "##6666FF,##66FF66,
##FF6666,##66AAAA"
Set the background for the entire chart
area to a light blue.
Get the pie slice colors from a custom list,
which uses hexadecimal color numbers.
The double pound signs prevent
ColdFusion from trying to interpret the
color data as variable names.
LegendFont="Times"
Use Times font for the legend.