Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 1007

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
Employee.StartDate,
<cfloop index="i" from="1"
to="#GetSalaries.RecordCount#">
<cfset
GetSalaries.StartDate[i]=NumberFormat(DatePart("yy
yy", GetSalaries.StartDate[i]) ,9999)>
</cfloop>
<cfquery dbtype = "query" name = "HireSalaries">
SELECT
StartDate,
AVG(Salary) AS AvgByStart
FROM GetSalaries
GROUP BY StartDate
</cfquery>
<cfloop index="i" from="1"
to="#HireSalaries.RecordCount#">
<cfset
HireSalaries.AvgByStart[i]=Round(HireSalaries.AvgB
yStart[i]/1000)*1000>
</cfloop>
<cfchart
chartWidth=400
BackgroundColor="##FFFF00"
show3D="yes"
>
<cfchartseries
type="area"
query="HireSalaries"
valueColumn="AvgByStart"
itemColumn="StartDate"
/>
</cfchart>
Setting curve chart characteristics
Curves charts use the attributes already discussed. However, curve charts require a large amount of processing to
render. For fastest performance, create them offline, write them to a file or variable, and then reference them in your
application pages. For information on creating offline charts, see
Administering charts
Use the ColdFusion Administrator to administer charts. In the Administrator, you can choose to save cached charts
in memory or to disk. You can also specify the number of charts to cache, the number of charting threads, and the disk
file for caching images to disk.
ColdFusion caches charts as they are created. In that way, repeated requests of the same chart load the chart from the
cache rather than having ColdFusion render the chart over and over again.
Note: You do not have to perform any special coding to reference a cached chart. Whenever you use the cfchart tag,
ColdFusion inspects the cache to see if the chart has already been rendered. If so, ColdFusion loads the chart from the
cache.
The following table describes the settings for the ColdFusion charting and graphing engine:
Description
Add the employee start date to the data in the GetSalaries query.
Use a
cfloop
tag to extract the year of hire from the 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 an area chart using the HireSalaries query. Chart the average
salaries against the start date.
Limit the chart width to 400 pixels, show the chart in three dimensions,
and set the background color to white.
"Writing a chart to a
Last updated 1/20/2012
variable" on page 1003.
1002

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents