DevLearningTools

MODULE 13 · LESSON 16

<cfchart>

Generating charts and graphs with cfchart and its nested cfchartseries/cfchartdata tags, a real query-driven chart, URL drill-down, the removal of format="flash" in ColdFusion 2025, and real gaps in Lucee's implementation.

New lessons are added one at a time as the course gets built out — a graded quiz for each lesson is still on the way.

cfchart generates a chart or graph directly in CFML, without reaching for an external JavaScript charting library. The actual data comes from one or more nested cfchartseries tags, each holding cfchartdata points or pulling from a query.

Learning Objectives

After completing this lesson, you'll be able to:

  • Build a basic chart from static data points.
  • Generate a chart directly from a query.
  • Add clickable drill-down with the url attribute.
  • Recognize real gaps in Lucee's cfchart implementation.

How the Pieces Fit Together

Query or Static cfchartdata Points

cfchartseries (type + data)

cfchart (dimensions + styling)

Rendered Chart

A Basic Pie Chart

Tag Syntax
<cfchart format="html" chartheight="300" chartwidth="400" title="Car Sales">
    <cfchartseries type="pie">
        <cfchartdata item="New Cars" value="50000">
        <cfchartdata item="Used Cars" value="25000">
    </cfchartseries>
</cfchart>
Rendered Output — Car Sales (illustrative)
New Cars67%
Used Cars33%

cfchart's Core Attributes

AttributeMeaning
formathtml (default), jpg, png; flash was removed in the ColdFusion 2025 release
chartwidth / chartheightDefaults to 320×240 pixels
titleThe chart's title
show3d / showlegend / showborderDisplay toggles
xaxistitle / yaxistitleAxis labels
scalefrom / scaletoExplicit Y-axis range
labelformatnumber (default), currency, percent, or date
stylebeige, blue, default, red, silver, or yellow
gridlines / showxgridlines / showygridlinesGrid display
urlMakes data points clickable; supports $VALUE$, $ITEMLABEL$, $SERIESLABEL$ placeholders
nameA variable to hold the chart's binary data instead of rendering it directly

cfchartseries's Attributes

AttributeMeaning
typebar, line, pyramid, area, horizontalbar, cone, curve, cylinder, step, scatter, or pie (required)
queryA query to pull data from, instead of nested cfchartdata tags
itemcolumn / valuecolumnWhich query columns hold item labels and values
serieslabel / seriescolorThis series' label and color
paintstyleplain, raise, shade, or light
colorlistComma-delimited colors, for a pie chart's individual slices
datalabelstylenone, value, rowlabel, columnlabel, or pattern
NOTE

query-driven data is configured on cfchartseries, not on the outer cfchart tag itself.

A Real Example: A Chart Driven Directly by a Query

Tag Syntax
<cfchart format="html" title="Monthly Revenue" chartwidth="500">
    <cfchartseries
        type="bar"
        query="monthlyRevenue"
        itemcolumn="monthName"
        valuecolumn="totalRevenue"
        serieslabel="Revenue">
    </cfchartseries>
</cfchart>
Rendered Output — Monthly Revenue (illustrative)
18,400Jan21,200Feb26,800Mar24,100Apr

Y: totalRevenue · X: monthName

NOTE

Illustrative sample data, exactly what monthlyRevenue's rows would supply once itemcolumn and valuecolumn are pointed at the right columns.

A Real Example: Clickable Drill-Down

Tag Syntax
<cfchart format="html" title="Sales by Region" url="/reports/region-detail.cfm?region=$ITEMLABEL$&amount=$VALUE$">
    <cfchartseries type="bar" query="salesByRegion" itemcolumn="region" valuecolumn="totalSales">
    </cfchartseries>
</cfchart>
Rendered Output — Sales by Region (illustrative)
32,000North27,500South19,800East24,300West

Y: totalSales · X: region

NOTE

$ITEMLABEL$, $VALUE$, and $SERIESLABEL$ are substituted per data point, letting a click on one bar or slice navigate to a detail page for exactly that item. Each bar above would link to that region's own detail page.

A Real Gotcha: format="flash" Is Gone

NOTE

format="flash" was removed entirely in the ColdFusion 2025 release. Code still targeting it needs to move to html, jpg, or png.

Real Gaps in Lucee's cfchart

AspectAdobe cfchartLucee chart
Output formatshtml (default), jpg, png (flash removed in CF2025)gif, jpg, or png only, no html output format
PackagingBuilt inRequires the Chart Extension for Jakarta EE (Lucee 7+)
Unimplemented attributesgridlines, seriesPlacement, style, tipbgcolor, tipStyle, xAxisType, and yAxisType have no effect on Lucee
NOTE

The missing html output format is the more consequential gap, an Adobe chart relying on html's interactivity doesn't have a direct equivalent rendering mode on Lucee.

A Real Operational Detail: Charting Settings in the Administrator

NOTE

Adobe's ColdFusion Administrator has a Server Settings > Charting page controlling server-side chart caching and concurrent chart-request limits, worth tuning for a chart-heavy application under real load.

Common Beginner Mistakes

Using format="flash" on ColdFusion 2025+

It was removed entirely in that release, existing code needs to move to html, jpg, or png.

Setting query on cfchart instead of cfchartseries

Query-driven data is configured on cfchartseries (query, itemcolumn, valuecolumn), not on the outer cfchart tag.

Assuming gridlines, style, or tipStyle work identically on Lucee

Lucee's documentation lists them as unimplemented, along with seriesPlacement, tipbgcolor, xAxisType, and yAxisType, they have no effect there.

Relying on html format output on Lucee

Lucee's cfchart only supports gif, jpg, or png, there's no html rendering mode to fall back to.

Best Practices

  • Use html format for modern, interactive charts on Adobe ColdFusion; reach for jpg/png when a static image (a report, an email) is actually needed.
  • Use url with $VALUE$/$ITEMLABEL$/$SERIESLABEL$ for drill-down dashboards instead of building separate click handling.
  • Verify Lucee's unimplemented attribute list before relying on gridlines, style, or the tooltip attributes cross-engine.
  • Tune the Administrator's charting cache and concurrency settings for a chart-heavy page under real production load.

Interview Questions

Where is query-driven chart data actually configured, cfchart or cfchartseries?

cfchartseries, via its query, itemcolumn, and valuecolumn attributes, not the outer cfchart tag.

What happened to format="flash"?

It was removed entirely in the ColdFusion 2025 release, existing code needs to migrate to html, jpg, or png.

What's the most consequential gap in Lucee's cfchart compared to Adobe's?

Lucee only supports gif, jpg, or png output, there's no html rendering format, unlike Adobe where html is actually the default.

How would you make a chart's data points clickable, linking to a detail page for the specific item clicked?

Set cfchart's url attribute with $ITEMLABEL$, $VALUE$, and/or $SERIESLABEL$ placeholders, substituted per data point when rendered.

Summary

In this lesson, you built a chart from static data and directly from a query, added clickable drill-down with url, covered the removal of format="flash" in ColdFusion 2025, and real gaps in Lucee's cfchart, missing html output and several unimplemented styling attributes.

What's Next?

The next lesson covers cfimage, resizing, cropping, and manipulating images directly in CFML.