<cfchart>

edit

Generates and displays a chart.

https://github.com/lucee/extension-chart

This tag may have a body.

This tag is also supported within <cfscript>

Requires Extension: Chart Extension for Jakarta EE (Lucee 7+)

<cfchart backgroundColor=string chartHeight=number chartWidth=number dataBackgroundColor=string font=string fontBold=boolean fontItalic=boolean fontSize=number foregroundColor=string format=string gridlines=number labelFormat=string categoryLabelPositions=string markerSize=number name=string pieSliceStyle=string scaleFrom=number scaleTo=number seriesPlacement=string show3D=boolean showBorder=any showLegend=boolean showMarkers=boolean showXGridlines=boolean showXLabel=boolean showTooltip=boolean source=string showYGridlines=boolean sortXAxis=boolean style=string title=string tipbgcolor=string tipStyle=string url=string xAxisTitle=string xAxisType=string xOffset=number yAxisTitle=string yAxisType=string yOffset=number base64=boolean ><!--- body --->[</cfchart>]
Attribute Description
backgroundColor
string, optional
edit

Color of the area between the data background and the chart border, around labels and around the legend. Hexadecimal value or supported named color. For a hex value, use the form: textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash signs or none.

chartHeight
number, optional
edit

Chart height; integer number of pixels

chartWidth
number, optional
edit

Chart width; integer number of pixels

dataBackgroundColor
string, optional
edit

color for control. For a hex value, use the form: textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash signs or none.

font
string, optional
edit

Font of data in column.

fontBold
boolean, optional
edit

Yes: displays grid control text in bold

fontItalic
boolean, optional
edit

Yes: displays grid control text in italics

fontSize
number, optional
edit

Size of text in column.

foregroundColor
string, optional
edit

color for control. For a hex value, use the form: textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash signs or none.

format
string, optional
edit

File format in which to save graph.

  • gif
  • jpg
  • png
labelFormat
string, optional
edit

Format for Y-axis labels.

categoryLabelPositions
string, optional
edit

Label position relative to axis: standard, up_45, up_90, down_45, down_90 or horizontal (standard) and vertical (down_90). Default is horizontal.

markerSize
number, optional
edit

Size of data point marker in pixels. Integer.

name
string, optional
edit

Page variable name. String. Generates the graph as binary data and assigns it to the specified variable. Suppresses chart display. You can use the name value in the cffile tag to write the chart to a file.

pieSliceStyle
string, optional
edit

Applies to chartseries type attribute value pie.

scaleFrom
number, optional
edit

Y-axis minimum value; integer

scaleTo
number, optional
edit

Y-axis max value; integer

show3D
boolean, optional
edit

Display chart with three-dimensional appearance.

showBorder
any, optional
edit

Whether to display a border around the chart

showLegend
boolean, optional
edit

yes: if chart contains more than one data series, display legend

showMarkers
boolean, optional
edit

Applies to chartseries type attribute values line, curve and scatter. yes: display markers at data points

showXGridlines
boolean, optional
edit

yes: display X-axis gridlines

showXLabel
boolean, optional
edit

yes: shows the x-axis labels

showTooltip
boolean, optional
edit

show the tooltip or not

source
string, optional
edit

variable name of the source path, if set the path to the source file is returned and no image tag is written to response stream.

showYGridlines
boolean, optional
edit

yes: display Y-axis gridlines

sortXAxis
boolean, optional
edit

Display column labels in alphabetic order along X-axis. Ignored if the xAxisType attribute is scale.

title
string, optional
edit

Title of the chart.

url
string, optional
edit

URL to open if the user clicks item in a data series; the onClick destination page.

The following variables will be substituted [ $SERIESLABEL$, $ITEMLABEL$, $VALUE$ ]

If the url does not contain a ? the following is appended

?series=$SERIESLABEL$&category=$ITEMLABEL$&value=$VALUE$

Otherwise, you will need to specify the query string manually

If the url starts with javascript: only variable substitution is done (since 1.20.1)

xAxisTitle
string, optional
edit

text; X-axis title

xOffset
number, optional
edit

Applies if show3D="yes". Number of units by which to display the chart as angled, horizontally

yAxisTitle
string, optional
edit

text; X-axis title

yOffset
number, optional
edit

Applies if show3D="yes". Number of units by which to display the chart as angled, horizontally.

base64
boolean, optional
edit

Render chart inline using a base64 data url.

Unimplemented Attribute(s)

Attribute Description
gridlines
number, optional
edit

Number of grid lines to display on value axis, including axis; positive integer.

* unimplemented *
seriesPlacement
string, optional
edit

Applies to charts that have more than one data series. Relative positions of series.

* unimplemented *
style
string, optional
edit

XML file or string to use to specify the style of the chart.

* unimplemented *
tipbgcolor
string, optional
edit

color for control. For a hex value, use the form: textColor = "##xxxxxx", where x = 0-9 or A-F; use two hash signs or none.

* unimplemented *
tipStyle
string, optional
edit

Determines the action that opens a popup window to display information about the current chart element.

  • mouseDown: display if the user positions the cursor at the element and clicks the mouse. Applies only to Flash format graph files (Flash not supported).
  • mouseOver: displays if the user positions the cursor at the element
  • none: suppresses display
* unimplemented *
xAxisType
string, optional
edit
  • category The axis indicates the data category. Data is sorted according to the sortXAxis attribute.
  • scale The axis is numeric. All cfchartdata item attribute values must numeric. The X axis is automatically sorted numerically.
* unimplemented *
yAxisType
string, optional
edit

Currently has no effect, as Y axis is always used for data values. Valid values are category and scale

* unimplemented *

Examples

edit

Example for cfchart

<cfchart format="jpg" title="Sales Report" backgroundcolor="cyan" showborder="true">
  <cfchartseries type="pie">
    <cfchartdata item="2012" value="2000">
    <cfchartdata item="2013" value="4000">
    <cfchartdata item="2014" value="5000">
    <cfchartdata item="2015" value="7000">
  </cfchartseries>
</cfchart>

See also