Skip to main content

Line Chart

Rocket 2.0

The Line Chart component plots one or more series as lines, which suits trends over time such as revenue by month or daily sign-ups.

Properties​

Property
Description
Expected Value
DataThe rows to plot, for example {{queries.getSales.data}}.Array
X fieldThe field shown along the horizontal axis, such as a month or date.Text. Default: month
Series fields (one or many)The field or fields to draw as lines, one line each. Separate several fields with commas or give a list.Text. Default: revenue, expenses
CurveHow points are joined. monotone draws smooth curves, linear straight segments and step right-angled steps.monotone, linear, step. Default: monotone
DotsDraws a dot at every data point.On or off. Default: Off
Line width (px)Thickness of the lines in pixels.Number. Default: 2
Dashed series (fields)Series fields to draw as dashed lines, separated by commas, for example to show a forecast.Text
Target line valueDraws a dashed horizontal line at this value, such as a target or limit. Leave empty for no line.Text
Target line labelText shown beside the target line.Text
Value formatHow values are shown on the axis and in tooltips: as a number, currency, percent or compact number such as 12K.number, currency, percent, compact. Default: number
Currency codeCurrency code used when Value format is currency, such as USD or EUR.Text. Default: USD
LocaleLocale used to format numbers, such as en-US or de-DE. Leave empty to use the browser's locale.Text
Value prefixText added before every value, such as ~.Text
Value suffixText added after every value, such as units.Text
Empty messageText shown when there is no data to plot.Text. Default: No data
AnimateAnimates the lines when the chart first draws or the data changes.On or off. Default: On
GridShows horizontal grid lines behind the chart.On or off. Default: On
LegendShows a legend naming each series. It appears only when there is more than one series.On or off. Default: On
Series labels ({ field: label })Display names for series, for example { revenue: "Revenue" }. Unlisted series show their field name.Object
Series colors (in order)Colors for the series, in the same order as Series fields.Array
Highlight clicked pointKeeps the clicked point emphasized until another point is clicked or Clear clicked point runs.On or off. Default: Off
Loading lookWhat shows while the component is loading: a Spinner or a 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 removes its highlight.components.linechart1.clearClickedPoint()
Set visibilityShows the component when true, hides it when false.components.linechart1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.linechart1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.linechart1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
dataThe rows to plot, for example {{queries.getSales.data}}.{{components.linechart1.data}}
xFieldThe field shown along the horizontal axis, such as a month or date.{{components.linechart1.xField}}
yFieldsThe field or fields to draw as lines, one line each. Separate several fields with commas or give a list.{{components.linechart1.yFields}}
curveHow points are joined. monotone draws smooth curves, linear straight segments and step right-angled steps.{{components.linechart1.curve}}
showDotsDraws a dot at every data point.{{components.linechart1.showDots}}
strokeWidthThickness of the lines in pixels.{{components.linechart1.strokeWidth}}
dashedFieldsSeries fields to draw as dashed lines, separated by commas, for example to show a forecast.{{components.linechart1.dashedFields}}
referenceValueDraws a dashed horizontal line at this value, such as a target or limit. Leave empty for no line.{{components.linechart1.referenceValue}}
referenceLabelText shown beside the target line.{{components.linechart1.referenceLabel}}
yAxisFormatHow values are shown on the axis and in tooltips: as a number, currency, percent or compact number such as 12K.{{components.linechart1.yAxisFormat}}
currencyCurrency code used when Value format is currency, such as USD or EUR.{{components.linechart1.currency}}
localeLocale used to format numbers, such as en-US or de-DE. Leave empty to use the browser's locale.{{components.linechart1.locale}}
valuePrefixText added before every value, such as ~.{{components.linechart1.valuePrefix}}
valueSuffixText added after every value, such as units.{{components.linechart1.valueSuffix}}
emptyTextText shown when there is no data to plot.{{components.linechart1.emptyText}}
animateAnimates the lines when the chart first draws or the data changes.{{components.linechart1.animate}}
showGridShows horizontal grid lines behind the chart.{{components.linechart1.showGrid}}
showLegendShows a legend naming each series. It appears only when there is more than one series.{{components.linechart1.showLegend}}
seriesLabelsDisplay names for series, for example { revenue: "Revenue" }. Unlisted series show their field name.{{components.linechart1.seriesLabels}}
colorsColors for the series, in the same order as Series fields.{{components.linechart1.colors}}
highlightClickedKeeps the clicked point emphasized until another point is clicked or Clear clicked point runs.{{components.linechart1.highlightClicked}}
loadingIndicatorWhat shows while the component is loading: a Spinner or a Skeleton block.{{components.linechart1.loadingIndicator}}
clickedDataPointThe data row of the point the user clicked last.{{components.linechart1.clickedDataPoint}}
isVisibleWhether the component is visible.{{components.linechart1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.linechart1.isLoading}}
isDisabledWhether the component is disabled.{{components.linechart1.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
Target line 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.