|
ColdFusion 9.0 Resources |
cfchartseriesDescriptionUsed with the cfchart tag. This tag defines the chart style in which the data displays: bar, line, pie, and so on. Syntax<cfchartseries
type="type"
itemColumn="query column"
valueColumn="query column"
colorlist = "list"
dataLabelStyle="style"
markerStyle="style"
paintStyle="plain|raise|shade|light"
query="query name"
seriesColor="hexadecimal value|web color"
seriesLabel="label text">
</cfchartseries>
Note: You can specify
this tag’s attributes in an attributeCollection attribute
whose value is a structure. Specify the structure name in the attributeCollection attribute
and use the tag’s attribute names as structure keys.
HistoryColdFusion MX 7:
ColdFusion MX 6.1: Changed interpolation behavior: the tag now interpolates data points on line charts with multiple series. ColdFusion MX: Added this tag. Attributes
UsageFor a pie chart, ColdFusion sets pie slice colors as follows:
Example<!--- The following example analyzes the salary data in the cfdocexamples
database and generates a bar chart showing average salary by department. --->
<!--- Get the raw data from the database. --->
<cfquery name="GetSalaries" datasource="cfdocexamples">
SELECT Departmt.Dept_Name,
Employee.Dept_ID,
Employee.Salary
FROM Departmt, Employee
WHERE Departmt.Dept_ID = Employee.Dept_ID
</cfquery>
<!--- Use a query of queries to generate a new query with --->
<!--- statistical data for each department. --->
<!--- AVG and SUM calculate statistics. --->
<!--- GROUP BY generates results for each department. --->
<cfquery dbtype = "query" name = "DataTable">
SELECT
Dept_Name,
AVG(Salary) AS avgSal,
SUM(Salary) AS sumSal
FROM GetSalaries
GROUP BY Dept_Name
</cfquery>
<!--- Reformat the generated numbers to show only thousands. --->
<cfloop index = "i" from = "1" to = "#DataTable.RecordCount#">
<cfset DataTable.sumSal[i] = Round(DataTable.sumSal[i]/1000)*1000>
<cfset DataTable.avgSal[i] = Round(DataTable.avgSal[i]/1000)*1000>
</cfloop>
<h1>Employee Salary Analysis</h1>
<!--- Bar graph, from Query of Queries --->
<cfchart format="flash"
xaxistitle="Department"
yaxistitle="Salary Average">
<cfchartseries type="bar"
query="DataTable"
itemcolumn="Dept_Name"
valuecolumn="avgSal" />
</cfchart>
|