Skip to main content

The Pie Chart component for Retool Apps

A content area to display pie charts.

The Pie Chart component renders data in a circle, with percentage-based slices. Pie Chart is useful for visualizing how different parts make up a whole.

Properties

All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.

barGap

The gap between bars relative to the size of the bars. This can be a number between 0 and 1.

Type number
Format Float
Mutability
ControlUsage
Retool UI Inspector > Appearance
Default
0.4
Examples
0.1

barGroupGap

The gap between bars in a group relative to the size of the bars. This can be any number between 0 and 1.

Type number
Format Float
Mutability
ControlUsage
Retool UI Inspector > Appearance
Default
0
Examples
0.1

barMode

The list of bar modes.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector > Appearance
Allowed Values
ValueUI OptionDescription
stackStack

Stacked mode.

groupGroup

Grouped mode.

overlayOverlay

Overlay mode.

relativeRelative

Relative mode.

Default
stack
Examples
"stack"

barOrientation

The orientation of the bars.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector > Appearance
Allowed Values
ValueUI OptionDescription
verticalVertical

Vertical orientation.

horizontalHorizontal

Horizontal orientation.

Default
vertical
Examples
"vertical"

chartType

The type of chart to display.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector > Content > Series
Allowed Values
ValueUI OptionDescription
barBar

Bar Chart or Stacked Bar Chart.

bubbleBubble

Bubble Chart.

funnelFunnel

Funnel Chart.

heatmapHeatmap

Heat Map.

lineLine

Line Chart or Sparkline.

mixedMixed

Mixed Chart.

piePie

Pie Chart.

plotlyJsonPlotly JSON

Plotly JSON Chart.

sankeySankey

Sankey Chart.

scatterScatter

Scatter Chart.

sunburstSunburst

Sunburst Chart.

treemapTreemap

Treemap.

waterfallWaterfall

Waterfall Chart.

Default
pie
Examples
"bar"

clearOnEmptyData

Whether to clear the chart when the data is empty.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Content
Default
false
Examples
true

colorArray

A list of colors to use when colorInputMode is colorArray.

Type array
Format Color
Array values string
Mutability
ControlUsage
Retool UI Inspector
Examples
["#ff0000", "#00ff00", "#0000ff"]

colorArrayDropDown

A list of colors to use when colorInputMode is colorArrayDropDown.

Type array
Format Color
Array values string
Mutability
ControlUsage
Retool UI Inspector > Appearance
Examples
["#ff0000", "#00ff00", "#0000ff"]

colorInputMode

The mode for the color input.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector > Appearance
Allowed Values
ValueUI OptionDescription
colorArrayArray

Color array.

gradientColorArrayPalette

Gradient color array.

colorArrayDropDownManual

Color array dropdown.

Default
colorArray
Examples
"colorArray"

gradientColorArray

A list of colors to use when colorInputMode is gradientColorArray.

Type array
Format Color
Array values string
Mutability
ControlUsage
Retool UI Inspector > Appearance

heatmapShowScale

Whether to display the color scale legend.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Appearance
Default
true
Examples
true

hidden

Whether this object is hidden from view.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector > Appearance
MethodsetHidden()
Default
false
Examples
true

hoverTemplate

The tooltip template for displaying information when you hover over a point.

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector > Content > Add-ons
Default
%{value}<br>%{percent}<extra></extra>
Examples
%{value}<br>%{percent}<extra></extra>

id

The unique identifier (name).

Type string
Format Plain Text
Mutability
ControlUsage
Retool UI Inspector
Default
pieChart1
Examples
query1
button1

labelData

A list of labels for each node.

Type array
Array values string
Mutability
ControlUsage
Retool UI Inspector > Content
Default
[]
Examples
["Node 1", "Node 2", "Node 3"]

legendPosition

The position of the legend.

Type string
Mutability
ControlUsage
Retool UI Inspector > Content > Add-ons
Allowed Values
ValueUI OptionDescription
topAlign top

Top.

rightAlign right

Right.

bottomAlign bottom

Bottom.

leftAlign left

Left.

noneNo legend

None.


parentData

The parent to which a given node is associated.

Type array
Array values string
Mutability
ControlUsage
Retool UI Inspector

pieDataHole

Specifies hole depth, between 0 and 1.

Type number
Mutability
ControlUsage
Retool UI Inspector

plotlyDataJson

The data to be displayed, in Plotly JSON format.

Type array
Array values object
Mutability
ControlUsage
Retool UI Inspector

plotlyLayoutJson

The layout, in Plotly JSON format.

Type object
Mutability
ControlUsage
Retool UI Inspector

rangeSlider

Whether to display a range slider.

Type boolean
Mutability
ControlUsage
Retool UI Inspector > Content > Add-ons

sankeyAllowDuplicateNodesAtDifferentSteps

Whether to allow duplicate nodes at different steps.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

sankeyDatasource

The data source for the Sankey Chart.

Type object
Mutability
ControlUsage
Retool UI Inspector

sankeyLinkColorArray

The link color scale, input as an array of colors.

Type array
Array values string
Mutability Read-only

sankeyLinkColorArrayDropDown

The link color scale, manually selected.

Type string
Mutability Read-only

sankeyLinkColorInputMode

The input mode for the link color scale.

Type string
Mutability
ControlUsage
Retool UI Inspector
Allowed Values
ValueDescription
colorArray

Color array.

gradientColorArray

Gradient color array.

colorArrayDropDown

Color array dropdown.


sankeyLinkGradientColorArray

The link color scale.

Type array
Mutability Read-only

sankeyLinkHoverTemplate

The template for the hover information.

Type string
Mutability
ControlUsage
Retool UI Inspector

sankeyNodeHoverTemplate

The template for the hover information.

Type string
Mutability
ControlUsage
Retool UI Inspector

stackedBarTotalsDataLabelPosition

The position of the stack data labels on a stacked bar chart.

Type string
Mutability
ControlUsage
Retool UI Inspector
Allowed Values
ValueDescription
center

Center.

inside

Inside.

outside

Outside.


style

Custom style options.

Type object
Mutability
ControlUsage
Retool UI Inspector > Appearance

sunburstDataBranchValues

The branch values for the Sunburst Chart.

Type string
Mutability
ControlUsage
Retool UI Inspector
Allowed Values
ValueDescription
remainder

The remainder branch values.

total

The total of the branch values.


sunburstDataLeafOpacity

The opacity of the leaf nodes in the Sunburst Chart.

Type number
Mutability
ControlUsage
Retool UI Inspector

textTemplate

The format to use for data labels, constructed in Plotly template format.

Type string
Mutability
ControlUsage
Retool UI Inspector > Content > Add-ons > Data labels

textTemplatePosition

The orientation of the data labels.

Type string
Mutability
ControlUsage
Retool UI Inspector > Content > Add-ons > Data labels
Allowed Values
ValueDescription
radial

Radial orientation.

horizontal

Horizontal orientation.

vertical

Vertical orientation.


title

The title text to display.

Type string
Mutability
ControlUsage
Retool UI Inspector

toolbar

The toolbar configuration.

Type object
Mutability
ControlUsage
Retool UI Inspector > Content > Add-ons
Object Properties

showAutoscale

Whether to show the Autoscale button.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector
Examples
true

showBoxSelect

Whether to show the Box select button.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector
Examples
true

showLassoSelect

Whether to show the Lasso select button.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector
Examples
true

showPan

Whether to show the Pan button.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector
Examples
true

showResetViews

Whether to show the Reset view button.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector
Examples
true

showToImage

Whether to show the Download as PNG button.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector
Examples
true

showZoomIn

Whether to show the Zoom in button.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector
Examples
true

showZoomOut

Whether to show the Zoom out button.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector
Examples
true

showZoomSelect

Whether to show the Zoom select button.

Type boolean
Format True/False
Mutability
ControlUsage
Retool UI Inspector
Examples
true


valueData

The value for a specific node.

Type array
Array values number
Mutability
ControlUsage
Retool UI Inspector

xAxis

The x-axis configuration.

Type object
Mutability
ControlUsage
Retool UI Inspector
Object Properties

lineWidth

The width of the line.

Type number
Mutability Read-only

rangeMax

The maximum value of the axis.

Type number
Mutability
ControlUsage
Retool UI Inspector

rangeMin

The minimum value of the axis.

Type number
Mutability
ControlUsage
Retool UI Inspector

rangeMode

The range mode of the axis.

Type string
Mutability
ControlUsage
Retool UI Inspector
Allowed Values
ValueDescription
auto

Auto.

manual

Manual.


scale

The scale of the axis.

Type string
Mutability
ControlUsage
Retool UI Inspector
Allowed Values
ValueDescription
linear

Linear.

log

Logarithmic.

time

showGridLines

Whether to show grid lines on the axis.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

showLine

Whether to show the axis line.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

showTickLabels

Whether to show tick labels on the x-axis.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

showZeroLine

Whether to show the zero line on the x-axis.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

sort

The sorting of the axis.

Type string
Mutability
ControlUsage
Retool UI Inspector
Allowed Values
ValueDescription
none

None.

ascending

Ascending.

descending

Descending.


tickFormat

The format of the axis tick labels.

Type string
Mutability
ControlUsage
Retool UI Inspector

title

The axis title.

Type string
Mutability
ControlUsage
Retool UI Inspector


yAxis

The y-axis configuration.

Type object
Mutability
ControlUsage
Retool UI Inspector
Object Properties

lineWidth

The width of the line.

Type number
Mutability Read-only

rangeMax

The maximum value of the axis.

Type number
Mutability
ControlUsage
Retool UI Inspector

rangeMin

The minimum value of the axis.

Type number
Mutability
ControlUsage
Retool UI Inspector

rangeMode

The range mode of the axis.

Type string
Mutability
ControlUsage
Retool UI Inspector
Allowed Values
ValueDescription
auto

Auto.

manual

Manual.


scale

The scale of the axis.

Type string
Mutability
ControlUsage
Retool UI Inspector
Allowed Values
ValueDescription
linear

Linear.

log

Logarithmic.

time

showGridLines

Whether to show grid lines on the axis.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

showLine

Whether to show the axis line.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

showTickLabels

Whether to show tick labels on the x-axis.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

showZeroLine

Whether to show the zero line on the x-axis.

Type boolean
Mutability
ControlUsage
Retool UI Inspector

sort

The sorting of the axis.

Type string
Mutability
ControlUsage
Retool UI Inspector
Allowed Values
ValueDescription
none

None.

ascending

Ascending.

descending

Descending.


tickFormat

The format of the axis tick labels.

Type string
Mutability
ControlUsage
Retool UI Inspector

title

The axis title.

Type string
Mutability
ControlUsage
Retool UI Inspector


Methods

JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.

pieChart.scrollIntoView()

Scrolls the canvas or parent container so that the selected component appears in the visible area.

Definition
pieChart.scrollIntoView(options)
Parameters

options Required

object

The scroll options.

Object Properties

behavior Required

string

The scroll behavior.

Supported Values
auto

Scroll immediately to the specified position.

smooth

Scroll gradually to the specified position.

block Required

string

The scroll position relative to the component.

Supported Values
nearest

Scrolls only the minimum amount required for the component to appear in the visible area. Scrolling does not occur if the component is already in view.

start

Scrolls to position the component at the top of the visible area.

center

Scrolls to position the component in the middle of the visible area.

end

Scrolls to position the component at the bottom of the visible area.

Examples

Scroll the minimum amount to immediately bring pieChart into view.

pieChart.scrollIntoView({behavior: 'auto', block: 'nearest'});

pieChart.setHidden()

Set the hidden value to toggle whether the component is visible. Defaults to true without a parameter.

Definition
pieChart.setHidden(hidden)
Parameters

hidden

boolean

Whether this object is hidden from view.

Examples

Hide pieChart.

pieChart.setHidden(true);

Unhide pieChart.

pieChart.setHidden(false);

Events

Events triggered by user interactions. Use event handlers to trigger queries or other actions in response to events.

hover

An item is hovered over.


unhover

An item is no longer hovered over.


clear

A value is cleared.


legendClick

A legend item is clicked or pressed.


legendDoubleClick

A legend item is double-clicked or pressed.


select

A value is selected.