MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual page 96

Table of Contents

Advertisement

76
6
Reviewing the code
The following table describes the highlighted code and its function:
Code
Employee.StartDate,
<cfloop index="i" from="1"
</cfloop>
<cfquery dbtype = "query" name =
"HireSalaries">
</cfquery>
<cfloop index="i" from="1"
</cfloop>
<cfgraph type="line"
query="HireSalaries"
valueColumn="AvgByStart"
itemColumn="StartDate"
title="Average Salaries by
Date of Hire"
fileFormat="Flash"
GraphWidth=400
BackgroundColor="##FFFF00"
Depth=5
lineColor="teal"
fill="yes"
Return to your browser and enter the following URL to view graphdata.cfm:
http://127.0.0.1/myapps/graphdata.cfm
to="#GetSalaries.RecordCount#">
<cfset GetSalaries.StartDate[i]=
NumberFormat(DatePart("yyyy",
GetSalaries.StartDate[i]) ,9999)>
SELECT
StartDate,
AVG(Salary) AS AvgByStart
FROM GetSalaries
GROUP BY StartDate
to="#HireSalaries.RecordCount#">
<cfset HireSalaries.AvgByStart[i]
=Round(HireSalaries.AvgByStart[i]
/1000)*1000>
Chapter 5 Graphing Data
Description
Add the employee start date to the data
in the GetSalaries query.
Use a
to extract the year of hire
cfloop
from each employee's hire data and
convert the result to a four-digit number.
Create a second query from the
GetSalaries query. This query contains
the average salary for each start year.
Round the salaries to the nearest
thousand.
Create a line graph using the
HireSalaries query. Graph the average
salaries against the start date.
Title the graph.
Send the graph to the user as a Flash
file.
Limit the graph width to 400 pixels.
Generator automatically resizes the
graph's height to maintain the aspect
ratio.
Display a 3D graph in teal against a
yellow background.
Fill the region below the graph to create
an area graph.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents