Charting data

One of the most important considerations when you chart data is the way that you supply the data to the cfchart tag. You can supply data in the following ways:

Note: The cfchart tag charts numeric data only. As a result, you must convert any dates, times, or preformatted currency values, such as $3,000.53, to integers or real numbers.

This section describes the following topics:

Charting individual data points

When you chart individual data points, you specify each data point by inserting a cfchartdata tag in the cfchartseries tag body. For example, the following code creates a simple pie chart:

<cfchart>
   <cfchartseries type="pie">
      <cfchartdata item="New Vehicle Sales" value=500000>
      <cfchartdata item="Used Vehicle Sales" value=250000>
      <cfchartdata item="Leasing" value=300000>
      <cfchartdata item="Service" value=400000>
   </cfchartseries>
</cfchart>

This pie chart displays four types of revenue for a car dealership. Each cfchartdata tag specifies a department's income and a description for the legend.

Note: If two data points have the same item name, ColdFusion creates a graph of the value for the last one specified within the cfchart tag.

The cfchartdata tag lets you specify the following information about a data point:

Attribute Description

value

The data value to be charted. This attribute is required.

item

(Optional) The description for this data point. The item appears on the horizontal axis of bar and line charts, on the vertical axis of horizontalbar charts, and in the legend of pie charts.


View comments in LiveDocs