Skip to content
ESM
import { PieChartModel } from "@arcgis/charts-components/model/pie-chart-model/pie-chart-model.js";
Inheritance:
PieChartModelchart-modelchart-model-baseEventTarget

Constructors

Constructor

inherited Constructor
Inherited from: ChartModelBase
Parameters
ParameterTypeDescriptionRequired
args
any[]

Properties

PropertyTypeClass
backgroundColor
inherited
chartId
inherited
chartRenderer
inherited
IDrawingInfo["renderer"] | undefined
chartSubType
readonly inherited
chartType
readonly inherited
colorMatch
inherited
config
inherited
dataLabelsSymbol
inherited
dataStore
inherited
any
descriptionSymbol
inherited
descriptionText
inherited
displayCategory
inherited
fetchNULLValues
inherited
string[]
layer
readonly inherited
legendMaxHeight
inherited
legendPosition
inherited
legendRoundMarker
inherited
legendTextSymbol
inherited
legendTitleSymbol
inherited
legendTitleText
inherited
legendVisibility
inherited
string[]
string[]
seriesLength
readonly inherited
splitByValues
readonly inherited
string[]
subtitleSymbol
inherited
subtitleText
inherited
titleSymbol
inherited
titleText
inherited
valueLabelMaxWidth
inherited
version
readonly inherited

aggregationType

Property
Type
WebChartStatisticType

Aggregation type for the pie chart.

alignDataLabels

Property
Type
boolean | undefined

Align the data labels on the left or right side of the chart instead of the default position around the chart.

asyncUpdatesPromise

inherited Property
Type
Promise<void>
Inherited from: ChartModelBase

Promise that resolves when the setup process is complete.

Note: This promise does not need to be awaited if the setup method has already been awaited. It is simply provided as a way to await the setup process from other functions if needed to avoid race conditions.

backgroundColor

inherited Property
Type
Color | undefined
Inherited from: WithBackgroundColor

The background color of the chart.

category

Property
Type
string

Category field for the pie chart.

chartId

inherited Property
Type
string | undefined
Inherited from: WithChartId

The chart ID.

chartRenderer

autocast inherited Property
Type
IDrawingInfo["renderer"] | undefined
Inherited from: WithChartRenderer

The chart renderer.

Example

In this example, we set the chartRenderer for a class-break heat chart.

heatChartModel.chartRenderer = {
"type": "classBreaks",
"field": "arcgis_charts_heat_chart_value",
"classBreakInfos": [
{
"label": "70 - 145",
"classMinValue": 70,
"classMaxValue": 145,
"symbol": {
"type": "esriSFS",
"color": [
212,
227,
255,
255
],
"style": "esriSFSSolid"
}
},
{
"label": "146 - 250",
"classMinValue": 146,
"classMaxValue": 250,
"symbol": {
"type": "esriSFS",
"color": [
43,
108,
240,
255
],
"style": "esriSFSSolid"
}
}
]
};

chartSubtitleVisibility

inherited Property
Type
boolean

Whether or not the chart subtitle is visible.

Note: Even if the subtitle is visible, it may not be displayed if the subtitle text is empty.

chartSubType

readonlyinherited Property
Type
ChartSubType
Inherited from: WithChartSubType

The chart sub type of the series.

chartTitleVisibility

inherited Property
Type
boolean

Whether or not the chart title is visible.

Note: Even if the title is visible, it may not be displayed if the title text is empty.

chartType

readonlyinherited Property
Type
ChartTypes
Inherited from: ChartModelBase

The chart type.

colorMatch

inherited Property
Type
boolean
Inherited from: WithColorMatch

Whether the chart should attempt to match the data source's colors.

true: Attempt to match the data source's colors. false: Use the colors defined in the config.

config

inherited Property
Type
ChartConfig
Inherited from: WithConfig

The current chart configuration object.

dataLabelsInside

Property
Type
boolean | undefined

Setting for placing the data labels inside of the slices.

dataLabelsOffset

Property
Type
number

Offset for the data labels.

dataLabelsSymbol

inherited Property
Type
WebChartTextSymbol | undefined
Inherited from: WithDataLabelsSymbol

Data labels text symbol (font, color, style).

dataLabelsVisibility

inherited Property
Type
boolean

Whether data labels are visible.

dataStore

inherited Property
Type
any
Inherited from: ChartModelBase

Data store object that can be used to store any data needed for the chart.

decimalPlaces

Property
Type
number

Number of decimal places to display in the slice values.

descriptionSymbol

inherited Property
Type
WebChartTextSymbol | undefined
Inherited from: WithDescriptionSymbol

The description text symbol. Contains styling information such as font, color, and symbol style.

descriptionText

inherited Property
Type
string
Inherited from: WithDescriptionText

descriptionVisibility

inherited Property
Type
boolean

Whether or not the chart description is visible.

Note: Even if the description is visible, it may not be displayed if the description text is empty.

displayCategory

inherited Property
Type
boolean
Inherited from: PieChartLegendModel

Whether to display the category in the legend.

displayCategoryOnDataLabel

Property
Type
boolean

Whether to display the category on the data label. Note: If the setting is not found in the config, it will default to true.

displayCategoryValueOnTooltip

Property
Type
boolean

Display category value on tooltip setting from the chart config.

Note: If the setting is not found in the config, it will default to true.

displayNumericValueOnDataLabel

Property
Type
boolean

Whether to display the numeric value on the data label. Note: If the setting is not found in the config, it will default to true.

displayNumericValueOnTooltip

Property
Type
boolean

Display numeric value on tooltip setting from the chart config.

Note: If the setting is not found in the config, it will default to true.

displayPercentageOnDataLabel

Property
Type
boolean

Whether to display the percentage on the data label.

Note: If the setting is not found in the config, it will default to true.

displayPercentageOnTooltip

Property
Type
boolean

Display percentage on tooltip setting from the chart config.

Note: If the setting is not found in the config, it will default to true.

displayType

Property
Type
PieChartSlicesDisplay

Display type for the pie chart slices. Specifies whether to display the slices as a percentage, value, or both.

endAngle

Property
Type
number | null | undefined

End angle of the pie chart.

fetchNULLValues

inherited Property
Type
boolean
Inherited from: WithFetchNULLValues

Whether to fetch null values for them to be counted or displayed as categories on the chart.

groupedSliceIds

Property
Type
string[]

Array of grouped slice ids for the pie chart.

groupingThreshold

Property
Type
number

Threshold below which slices will be grouped.

innerRadiusSize

Property
Type
number

Inner radius size for the pie chart.

labelCharacterLimit

Property
Type
number | null

Character limit for the slice labels.

layer

readonlyinherited Property
Type
SupportedLayer | undefined
Inherited from: WithLayer

The chart model's layer.

legendMaxHeight

inherited Property
Type
number | undefined
Inherited from: ModelWithLegend

Maximum legend height.

legendPosition

inherited Property
Type
WebChartLegendPositions
Inherited from: ModelWithLegend

Legend position: top, bottom, left, or right.

legendRoundMarker

inherited Property
Type
boolean
Inherited from: ModelWithLegend

Whether legend markers are rounded.

legendTextSymbol

inherited Property
Type
WebChartTextSymbol | undefined
Inherited from: ModelWithLegend

Legend item text symbol (font, color, style).

legendTitleSymbol

inherited Property
Type
WebChartTextSymbol | undefined
Inherited from: ModelWithLegend

Legend title text symbol (font, color, style).

legendTitleText

inherited Property
Type
string
Inherited from: ModelWithLegend

The legend title text.

legendTitleVisibility

inherited Property
Type
boolean
Inherited from: ModelWithLegend

Whether the legend title is visible.

legendVisibility

inherited Property
Type
boolean
Inherited from: ModelWithLegend

Whether the legend title is visible.

mode

Property
Type
PieChartDataModes

The pie chart data mode.

category - The chart is using values from the category field to determine each slice. fields - The chart is using aggregated values from the numeric fields to determine each slice.

numericFields

autocast Property
Type
string[]

Numeric fields for the pie chart.

optimizeDataLabelsOverlapping

Property
Type
boolean | undefined

Optimize data labels overlapping setting for the pie chart.

orderByList

Property
Type
string[]

List of category's values for custom sort.

Example
pieChartModel.orderByList = ["Field1", "Field2", "Field3"];

orderOfSlices

Property
Type
string[] | undefined

Order of the slice array by returning an array of slice ids

percentagePrefix

Property
Type
string | undefined

Prefix of the percentages of the slices.

percentageSuffix

Property
Type
string | undefined

Suffix of the percentages of the slices.

seriesLength

readonlyinherited Property
Type
number
Inherited from: WithSeriesLength

The length of the series array.

sliceGrouping

Property
Type
WebChartPieChartGroupSlice | undefined

Slice grouping configuration for the pie chart.

slices

Property
Type
WebChartPieChartSlice[] | undefined

Array of slices for the pie chart.

splitByValues

readonlyinherited Property
Type
string[]
Inherited from: WithSplitByValues

The split-by values for the chart.

startAngle

Property
Type
number | null | undefined

Start angle of the pie chart.

subtitleSymbol

inherited Property
Type
WebChartTextSymbol | undefined
Inherited from: WithSubtitleSymbol

The subtitle text symbol. Contains styling information such as font, color, and symbol style.

subtitleText

inherited Property
Type
string
Inherited from: WithSubtitleText

The chart subtitle text.

ticksSymbol

Property
Type
ISimpleLineSymbol | undefined

Ticks symbol connecting slices to labels.

ticksVisibility

Property
Type
boolean

Visibility of the ticks.

titleSymbol

inherited Property
Type
WebChartTextSymbol | undefined
Inherited from: WithTitleSymbol

The title text symbol. Contains styling information such as font, color, and symbol style.

titleText

inherited Property
Type
string
Inherited from: WithTitleText

The chart title text.

valueLabelMaxWidth

autocast inherited Property
Type
number
Inherited from: PieChartLegendModel

The maximum width in pixel for the legend value labels.

valuePrefix

Property
Type
string | undefined

Prefix of the values of the slices.

valueSuffix

Property
Type
string | undefined

Suffix of the values of the slice.

version

readonlyinherited Property
Type
string | undefined
Inherited from: WithVersion

The version of the chart configuration.

Methods

MethodSignatureClass
generateChartTitle(): string
getCustomSortValues(): Promise<string[]>
getDataFilters
inherited
getDataFilters(): WebChartDataFilters | undefined
getDataTooltipReverseColor(seriesIndex?: number): boolean
getDataTooltipValueFormat(seriesIndex: number): NumberFormatOptions | undefined
getDataTooltipVisibility(seriesIndex?: number): boolean
getDisplayNumericValue(): boolean
getDisplayPercentage(): boolean
getLabelMaxWidth
inherited
getLabelMaxWidth(): number
getOriginalSliceName(sliceIndex: number): Date | number | string | null | undefined
getSeriesId
inherited
getSeriesId(seriesIndex: number): string | undefined
getSeriesIndex
inherited
getSeriesIndex(seriesId: string): number | undefined
getSeriesVisibility(seriesIndex: number): boolean
getSliceColor(sliceIndex: number): Color | undefined
getSliceId(sliceIndex: number): string | undefined
getSliceIndex(sliceId: string): number | undefined
getSliceName(sliceIndex: number): string | undefined
getSlicesLength(): number
getSortOrder(): PieChartDataSortingKinds
isSameChartAs
inherited
isSameChartAs(otherModel: ChartModel | undefined): boolean
moveCustomSortValuesInOrderByList(fromIndex: number, toIndex: number): void
moveSeries(fromIndex: number, toIndex: number): void
resetAvailable(): boolean
resetSlices(): void
setDataFilters
inherited
setDataFilters(newDataFilters: WebChartDataFilters | undefined): Promise<void>
setDataTooltipReverseColor(reverseColor: boolean, seriesIndex?: number): void
setDataTooltipValueFormat(seriesIndex: number, valueFormat: NumberFormatOptions | undefined): void
setDataTooltipVisibility(visibility: boolean, seriesIndex?: number): void
setDisplayNumericValue(displayNumericValue: boolean): void
setDisplayPercentage(displayPercentage: boolean): void
setLabelMaxWidth
inherited
setLabelMaxWidth(labelMaxWidth: number | undefined): void
setSeriesVisibility(props: LegendItemVisibility): void
setSliceColor(color: Color | undefined, sliceIndex: number): void
setSliceName(name: string, sliceIndex: number): void
setSortOrder(sortOrder: PieChartDataSortingKinds, orderByList?: string[]): void
setup(params: ModelParams<ChartConfig<typeof ModelTypes.PieChart>>): Promise<void>
update
inherited
update(): Promise<void>

generateChartTitle

Method
Signature
generateChartTitle (): string

Generate the proper chart title given the current config.

Returns
string

getCustomSortValues

Method
Signature
getCustomSortValues (): Promise<string[]>

Gets the list of the category values for the chart.

Returns
Promise<string[]>

getDataFilters

inherited Method
Signature
getDataFilters (): WebChartDataFilters | undefined
Inherited from: WithDataFilters

Gets the data filter for the bar chart.

getDataTooltipReverseColor

inherited Method
Signature
getDataTooltipReverseColor (seriesIndex?: number): boolean
Inherited from: ModelWithTooltips

Gets the setting of the dataTooltipReverseColor property.

  • If the seriesIndex is provided, the dataTooltipReverseColor for that series will be returned. Otherwise, the same property of the first series will be returned.
  • If the dataTooltipReverseColor is not set on the series, the default value of false will be returned.
Parameters
ParameterTypeDescriptionRequired
seriesIndex

The index of the series.

Returns
boolean

getDataTooltipValueFormat

inherited Method
Signature
getDataTooltipValueFormat (seriesIndex: number): NumberFormatOptions | undefined

Gets the data tooltip value format for a series.

If the series index is out of bounds or the series list is empty, this function will return undefined.

Parameters
ParameterTypeDescriptionRequired
seriesIndex

The index of the series to retrieve the value format for.

Returns
NumberFormatOptions | undefined

getDataTooltipVisibility

inherited Method
Signature
getDataTooltipVisibility (seriesIndex?: number): boolean
Inherited from: ModelWithTooltips

Gets the visibility of the data tooltips.

  • If the seriesIndex is provided, the visibility for that series will be returned. Otherwise, the visibility of the first series will be returned.
  • If the visibility is not set on the series, the default value of true will be returned.
Parameters
ParameterTypeDescriptionRequired
seriesIndex

The index of the series.

Returns
boolean

getDisplayNumericValue

inherited Method
Signature
getDisplayNumericValue (): boolean
Inherited from: PieChartLegendModel

Gets the setting for the display of numerical value in the legend items.

Note: Only applicable to pie charts.

Returns
boolean

getDisplayPercentage

inherited Method
Signature
getDisplayPercentage (): boolean
Inherited from: PieChartLegendModel

Gets the setting for the display of percentage in the legend items.

Note: Only applicable to pie charts.

Returns
boolean

getLabelMaxWidth

inherited Method
Signature
getLabelMaxWidth (): number
Inherited from: PieChartLegendModel

Gets the maximum width in pixel for the legend item labels.

Note: Only applicable to pie charts.

Returns
number

getOriginalSliceName

Method
Signature
getOriginalSliceName (sliceIndex: number): Date | number | string | null | undefined

Gets the original name of the slice based on the slice index.

Parameters
ParameterTypeDescriptionRequired
sliceIndex

The index of the slice.

Returns
Date | number | string | null | undefined

getSeriesId

inherited Method
Signature
getSeriesId (seriesIndex: number): string | undefined
Inherited from: WithSeriesId

Gets the series ID for a given series index. If the series index is out of bounds, this function will return undefined.

Parameters
ParameterTypeDescriptionRequired
seriesIndex

The index of the series.

Returns
string | undefined

getSeriesIndex

inherited Method
Signature
getSeriesIndex (seriesId: string): number | undefined
Inherited from: WithSeriesIndex

Gets the series index for a given series ID. If the series ID is not found, this function will return undefined.

Parameters
ParameterTypeDescriptionRequired
seriesId

The ID of the series.

Returns
number | undefined

getSeriesVisibility

inherited Method
Signature
getSeriesVisibility (seriesIndex: number): boolean
Inherited from: WithSeriesVisibility

Gets the visibility of a series.

Parameters
ParameterTypeDescriptionRequired
seriesIndex

The series index

Returns
boolean

getSliceColor

Method
Signature
getSliceColor (sliceIndex: number): Color | undefined

Gets the color of the slice based on the slice index. If the index is out of bounds, this function will return undefined.

Parameters
ParameterTypeDescriptionRequired
sliceIndex

The index of the slice.

Returns
Color | undefined

getSliceId

Method
Signature
getSliceId (sliceIndex: number): string | undefined

Gets the slice id for a given slice index. If the index is out of bounds, this function will return undefined.

Parameters
ParameterTypeDescriptionRequired
sliceIndex

The index of the slice.

Returns
string | undefined

getSliceIndex

Method
Signature
getSliceIndex (sliceId: string): number | undefined

Gets the slice index for a given slice id. If the sliceId is not found, this function will return undefined.

Parameters
ParameterTypeDescriptionRequired
sliceId

The id of the slice.

Returns
number | undefined

getSliceName

Method
Signature
getSliceName (sliceIndex: number): string | undefined

Gets the name of the slice based on the slice index. If the index is out of bounds, this function will return undefined.

Parameters
ParameterTypeDescriptionRequired
sliceIndex

The index of the slice.

Returns
string | undefined

getSlicesLength

Method
Signature
getSlicesLength (): number

Gets the length of the slices array.

Returns
number

getSortOrder

Method
Signature
getSortOrder (): PieChartDataSortingKinds

Gets the sort order for the pie chart.

isSameChartAs

inherited Method
Signature
isSameChartAs (otherModel: ChartModel | undefined): boolean
Inherited from: ChartModelBase

Checks if the current chart model is for the same chart as another chart model.

Parameters
ParameterTypeDescriptionRequired
otherModel

The other chart model to compare to.

Returns
boolean

moveCustomSortValuesInOrderByList

Method
Signature
moveCustomSortValuesInOrderByList (fromIndex: number, toIndex: number): void

Moves the custom sort values in-place for the order by list in the config. Note: This method should be only used when the sort order is set to customSort.

Parameters
ParameterTypeDescriptionRequired
fromIndex

The index to move the custom sort item from.

toIndex

The index to move the category item to.

Returns
void

moveSeries

Method
Signature
moveSeries (fromIndex: number, toIndex: number): void

Moves a series from one index in the series array to another.

Parameters
ParameterTypeDescriptionRequired
fromIndex

Index to move the series from.

toIndex

Index to move the series to.

Returns
void

resetAvailable

Method
Signature
resetAvailable (): boolean

Returns whether the series styling is able to be reset.

Returns
boolean

resetSlices

Method
Signature
resetSlices (): void

Resets the slices styling to the default styling.

Returns
void

setDataFilters

inherited Method
Signature
setDataFilters (newDataFilters: WebChartDataFilters | undefined): Promise<void>
Inherited from: WithDataFilters

Sets the data filter for the chart.

Parameters
ParameterTypeDescriptionRequired
newDataFilters

The new data filter.

Returns
Promise<void>

setDataTooltipReverseColor

inherited Method
Signature
setDataTooltipReverseColor (reverseColor: boolean, seriesIndex?: number): void
Inherited from: ModelWithTooltips

Sets the setting of the dataTooltipReverseColor property.

  • If the seriesIndex is provided, the reverse color will be set for that series only. Otherwise, the reverse color will be set for all series.
Parameters
ParameterTypeDescriptionRequired
reverseColor

Indicator of whether to reverse the color.

seriesIndex

The index of the series to set the reverse color.

Returns
void

setDataTooltipValueFormat

inherited Method
Signature
setDataTooltipValueFormat (seriesIndex: number, valueFormat: NumberFormatOptions | undefined): void

Sets the data tooltip value format for a series.

Parameters
ParameterTypeDescriptionRequired
seriesIndex

The index of the series to set the value format for.

valueFormat

The value format to set.

Returns
void

setDataTooltipVisibility

inherited Method
Signature
setDataTooltipVisibility (visibility: boolean, seriesIndex?: number): void
Inherited from: ModelWithTooltips

Sets the visibility of the data tooltips.

  • If the seriesIndex is provided, the visibility will be set for that series only. Otherwise, the visibility will be set for all series.
Parameters
ParameterTypeDescriptionRequired
visibility

The visibility of the data tooltips.

seriesIndex

The index of the series to set the visibility.

Returns
void

setDisplayNumericValue

inherited Method
Signature
setDisplayNumericValue (displayNumericValue: boolean): void
Inherited from: PieChartLegendModel

Sets the setting for the display of numerical value in the legend items.

Note: Only applicable to pie charts.

Parameters
ParameterTypeDescriptionRequired
displayNumericValue

The setting for the display of numerical value in the legend items

Returns
void

setDisplayPercentage

inherited Method
Signature
setDisplayPercentage (displayPercentage: boolean): void
Inherited from: PieChartLegendModel

Sets the setting for the display of percentage in the legend items.

Note: Only applicable to pie charts.

Parameters
ParameterTypeDescriptionRequired
displayPercentage

The setting for the display of percentage in the legend items

Returns
void

setLabelMaxWidth

inherited Method
Signature
setLabelMaxWidth (labelMaxWidth: number | undefined): void
Inherited from: PieChartLegendModel

Sets the maximum width in pixel for the legend item labels.

Note: Only applicable to pie charts.

Parameters
ParameterTypeDescriptionRequired
labelMaxWidth

The maximum width in pixel for the legend item labels

Returns
void

setSeriesVisibility

inherited Method
Signature
setSeriesVisibility (props: LegendItemVisibility): void
Inherited from: WithSeriesVisibility

Sets the visibility of a series.

Parameters
ParameterTypeDescriptionRequired
props

Visibility options for the series.

Returns
void

setSliceColor

Method
Signature
setSliceColor (color: Color | undefined, sliceIndex: number): void

Sets the color of the slice based on the slice index.

Parameters
ParameterTypeDescriptionRequired
color

The color for the slice.

sliceIndex

The index of the slice.

Returns
void

setSliceName

Method
Signature
setSliceName (name: string, sliceIndex: number): void

Sets name of the slice based on the slice index.

Parameters
ParameterTypeDescriptionRequired
name

The name for the slice.

sliceIndex

The index of the slice.

Returns
void

setSortOrder

Method
Signature
setSortOrder (sortOrder: PieChartDataSortingKinds, orderByList?: string[]): void

Sets the sort order for the pie chart.

Parameters
ParameterTypeDescriptionRequired
sortOrder

The sort order.

orderByList
string[]

The list of category values.

Returns
void

setup

Method
Signature
setup (params: ModelParams<ChartConfig<typeof ModelTypes.PieChart>>): Promise<void>

Completes the async setup process for the chart model. Must be called before using the model.

Parameters
ParameterTypeDescriptionRequired
params
ModelParams<ChartConfig<typeof ModelTypes.PieChart>>
Returns
Promise<void>

update

inherited Method
Signature
update (): Promise<void>
Inherited from: ChartModelBase

Can be awaited to allow any pending async updates to complete.

Returns
Promise<void>