Skip to main content
PieChartOptions
Options for a pie chart.
NameTypeDescription
color?stringOptional single color to use for all slices of pie.
colorGenerator?ColorGeneratorOptional function to call in order to establish the color to be used for each series
colors?Array<string>Optional list of colors to use for the slices of pie. You will need to know the order of the data points in order to match these - if you do not, you will want to use a colorGenerator instead.
data?Array<ObjectData>Optional data to load into the chart.
dataLabels?DataLabelsOptionsOptions for data labels. If true, the value for the slice is shown. If a string, it is used as a format string.
dataSource?DataSourceOptional data source (of type DataSource, meaning both VisuallyJsModel and Selection are supported) from which to retrieve data to load into the chart.
dataSourceFilter?ChartModelFilterWhen you provide dataSource, you can also provide a filter which accepts or rejects specific nodes/groups in the data source.
defaultColor?stringOptional color to use for every series. Overrides any colorGenerator.
emptyMessage?stringMessage to display when the chart has no data. Defaults to "No data".
grouped?booleanIf true, the data will be grouped, if the chart type supports it (eg Bar/Column).
groupField?stringThe name of the field that identifies which group a data point belongs to. Defaults to group.
height?numberHeight for the chart. If omitted, height is computed from the width of the chart's container
innerRadius?numberWhen you want a hole in the middle of the pie, this number specifies the ratio of that hole to the diameter of the pie. Valid values are, strictly speaking, in the range 0 - 1, but a value of 0 would result in no hole, and a value >= 1 would result in no chart.
interactive?booleanDefaults to false. When true, mouse clicks on a slice of the pie will select/deselect that slice.
labelFont?FontSpecOptional font specification for the data labels.
labelPosition?"inside" | "outside"Where to place labels. Defaults to "outside".
legend?boolean | LegendSpecEither a boolean true/false, indicating the legend should be shown/hidden, or a spec for a legend.
resizeObserver?booleanDefaults to true, meaning the chart will redraw when its container element resizes.
selectedCategory?numberThe index of the category (slice) to be selected. This will result in the slice being shifted out from the center of the pie.
selectedSliceOffset?numberThe number of pixels to offset the selected slice by. Defaults to 10.
seriesArray<RecordBasedSeriesOptions>Definition of the chart series' to display. You can display multiple series on a chart.
showLabels?"value" | "label" | "percentage" | "label-value" | "label-percentage"Defines what to show in the data labels.
'label' (default) shows the category name.
'value' shows the raw number.
'percentage' shows the slice's percentage of the total.
'label-value' shows label and value.
'label-percentage' shows label and percentage.
style?ChartStyleOptionsStyles for legend and grid.
subtitle?SubtitleSpecSubtitle for the chart.
title?ChartTitleSpecTitle for the chart.
titlePadding?numberPadding to leave underneath the title
tooltip?TooltipOptionsOptions for a tooltip for the chart.
url?stringOptional URL from which to retrieve data to load into the chart
width?numberWidth for the chart. If omitted, width is computed from the width of the chart's container
zoom?{
  enabled:boolean,
  initialValue:number,
  range:[number, number]
}
Optional zoom configuration.