Skip to main content

Area Chart

Rocket 2.0

The Area Chart component plots one or more series over a category or time axis, with the area under each line shaded. Use it to show trends such as revenue or sign-ups per month.

Properties​

Property
Description
Expected Value
DataThe rows to plot, as a list of objects, usually from a query.Array
X fieldThe field in each row that gives the label along the x-axis, such as a month or category.Text. Default: month
Series fields (one or many)The field or fields to plot as series. Use one field name, a list, or a comma-separated list.Text. Default: revenue
Value prefixText added before values on the axis and in tooltips, such as $.Text
Value suffixText added after values on the axis and in tooltips, such as %.Text
LegendShows a legend that names each series. It appears only when there is more than one series.On or off. Default: Off
Series labels ({ field: label })Names to show for series instead of their field names, such as { "revenue": "Revenue" }.Object
Empty messageMessage shown when there is no data to plot.Text. Default: No data
Series colors (in order)Colors for the series, in the same order as Series fields.Array
Line only (no fill)Draws each series as a line with no shaded area under it.On or off. Default: Off
Stack seriesStacks the series on top of each other so the top edge shows their total.On or off. Default: Off
CurveShape of the line between points: smooth (monotone, natural), straight (linear) or stepped (step).monotone, natural, linear, step. Default: monotone
Highlight clicked pointEmphasizes the point the user clicks until another is clicked or Clear clicked point runs.On or off. Default: Off
Loading lookWhat shows while the component is loading: a Spinner or a grey Skeleton block.Spinner, Skeleton. Default: Spinner

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On clickTriggers when the user clicks a point on the chart.
On double clickTriggers when the user double-clicks the chart.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Clear clicked pointClears the clicked point, and its highlight when Highlight clicked point is on.components.areachart1.clearClickedPoint()
Set visibilityShows the component when true, hides it when false.components.areachart1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.areachart1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.areachart1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
dataThe rows to plot, as a list of objects, usually from a query.{{components.areachart1.data}}
xFieldThe field in each row that gives the label along the x-axis, such as a month or category.{{components.areachart1.xField}}
yFieldsThe field or fields to plot as series. Use one field name, a list, or a comma-separated list.{{components.areachart1.yFields}}
valuePrefixText added before values on the axis and in tooltips, such as $.{{components.areachart1.valuePrefix}}
valueSuffixText added after values on the axis and in tooltips, such as %.{{components.areachart1.valueSuffix}}
showLegendShows a legend that names each series. It appears only when there is more than one series.{{components.areachart1.showLegend}}
seriesLabelsNames to show for series instead of their field names, such as { "revenue": "Revenue" }.{{components.areachart1.seriesLabels}}
emptyTextMessage shown when there is no data to plot.{{components.areachart1.emptyText}}
colorsColors for the series, in the same order as Series fields.{{components.areachart1.colors}}
lineOnlyDraws each series as a line with no shaded area under it.{{components.areachart1.lineOnly}}
stackStacks the series on top of each other so the top edge shows their total.{{components.areachart1.stack}}
curveShape of the line between points: smooth (monotone, natural), straight (linear) or stepped (step).{{components.areachart1.curve}}
highlightClickedEmphasizes the point the user clicks until another is clicked or Clear clicked point runs.{{components.areachart1.highlightClicked}}
loadingIndicatorWhat shows while the component is loading: a Spinner or a grey Skeleton block.{{components.areachart1.loadingIndicator}}
clickedDataPointThe data row of the point the user last clicked.{{components.areachart1.clickedDataPoint}}
isVisibleWhether the component is visible.{{components.areachart1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.areachart1.isLoading}}
isDisabledWhether the component is disabled.{{components.areachart1.isDisabled}}

Styles​

Style
Default
Chart color (series palette from it)Theme: Brand primary
Grid line colorTheme: Default border
Axis label colorTheme: Placeholder text
Legend text colorTheme: Placeholder text
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.