User Guide

Table Of Contents
Creating charts: examples 753
fontsize=14
fontBold="yes"
backgroundColor = "##CCFFFF"
show3D="yes"
>
<cfchartseries
type="pie"
query="DeptSalaries"
valueColumn="SumByDept"
itemColumn="Dept_Name"
colorlist="##6666FF,##66FF66,##FF6666,##66CCCC"
/>
</cfchart>
<br>
4.
Save the file as chartdatapie1.cfm.
5.
View the chartdatapie1.cfm page in your browser:
Reviewing the code
The following table describes the code and its function:
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
cfchart attributes.
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 tag, round the salary sums to the
nearest thousand.
<cfchart
tipStyle="mousedown"
font="Times"
fontBold="yes"
backgroundColor = "##CCFFFF"
show3D="yes"
>
Show a tip only when a user clicks on the chart,
display text in Times bold font, set the background
color to light blue, and display the chart in three
dimensions.
<cfchartseries
type="pie"
query="DeptSalaries"
valueColumn="SumByDept"
itemColumn="Dept_Name"
colorlist=
"##6666FF,##66FF66,##FF6666,##66CCCC"
/>
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.