User Guide
74 Chapter 2: ColdFusion Tags
cfchartdata
Description
Used with the cfchart and cfchartseries tags. This tag defines chart data points. Its data is
submitted to the
cfchartseries tag.
Category
Data output tags, Extensibility tags
Syntax
<cfchartdata
item = "text"
value = "number">
See also
cfchart
, cfchartseries; Chapter 31, “Creating Charts and Graphs,” in ColdFusion MX
Developer’s Guide
ColdFusion MX: Added this tag.
Attributes
Example
<!--- The following example analyzes the salary data in the cfdocexamples
database and generates a bar chart showing average salary by department. The
body of the cfchartseries tag loops over a cfchartdata tag to include data
available from the query. --->
<!--- 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
Attribute Req/Opt Default Description
item Required Data point name; string.
value Required Data point value; number or expression.