Skip to main content

Pie Chart

Rocket 2.0

The Pie Chart component shows how a total splits into parts, such as orders by channel or tickets by status. It can draw a full pie or a donut with a figure in the middle.

Properties​

Property
Description
Expected Value
DataRows to chart, one slice per row. Rows with a negative value are left out.Array
Category fieldField in each row that names the slice.Text. Default: type
Value fieldField in each row that sets the size of the slice.Text. Default: value
DonutDraws the chart as a ring with a hole in the middle instead of a full pie.On or off. Default: On
Center figureLarge figure shown in the hole of the donut, such as a total.Text
Center captionCaption shown under Center figure in the hole of the donut.Text
LegendShows a legend that names each slice and its color.On or off. Default: On
Empty messageMessage shown when there is no data to chart.Text. Default: No data
Series colors (in order)Colors for the slices, used in order. Leave empty to use the theme's chart colors, or matching status colors when every category is a status such as Completed or Missed.Array
Value prefixText shown before values in the tooltip, such as $.Text
Value suffixText shown after values in the tooltip, such as %.Text
Highlight clicked pointKeeps the clicked slice highlighted and dims the others until another slice is clicked or Clear clicked point runs.On or off. Default: Off
Loading lookWhat shows while the chart 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 slice.
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 slice and its highlight.components.piechart1.clearClickedPoint()
Set visibilityShows the component when true, hides it when false.components.piechart1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.piechart1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.piechart1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
dataRows to chart, one slice per row. Rows with a negative value are left out.{{components.piechart1.data}}
categoryFieldField in each row that names the slice.{{components.piechart1.categoryField}}
valueFieldField in each row that sets the size of the slice.{{components.piechart1.valueField}}
donutDraws the chart as a ring with a hole in the middle instead of a full pie.{{components.piechart1.donut}}
centerValueLarge figure shown in the hole of the donut, such as a total.{{components.piechart1.centerValue}}
centerLabelCaption shown under Center figure in the hole of the donut.{{components.piechart1.centerLabel}}
showLegendShows a legend that names each slice and its color.{{components.piechart1.showLegend}}
emptyTextMessage shown when there is no data to chart.{{components.piechart1.emptyText}}
colorsColors for the slices, used in order. Leave empty to use the theme's chart colors, or matching status colors when every category is a status such as Completed or Missed.{{components.piechart1.colors}}
valuePrefixText shown before values in the tooltip, such as $.{{components.piechart1.valuePrefix}}
valueSuffixText shown after values in the tooltip, such as %.{{components.piechart1.valueSuffix}}
highlightClickedKeeps the clicked slice highlighted and dims the others until another slice is clicked or Clear clicked point runs.{{components.piechart1.highlightClicked}}
loadingIndicatorWhat shows while the chart is loading: a spinner or a skeleton block.{{components.piechart1.loadingIndicator}}
clickedDataPointThe data row of the slice the user clicked last.{{components.piechart1.clickedDataPoint}}
isVisibleWhether the component is visible.{{components.piechart1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.piechart1.isLoading}}
isDisabledWhether the component is disabled.{{components.piechart1.isDisabled}}

Styles​

Style
Default
Chart color (series palette from it)Theme: Brand primary
Legend text colorTheme: Placeholder text
Slice border colorTheme: Surface 1
Center figure colorTheme: Primary text
Center caption 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.