Skip to main content
Version: 2027.02 Beta
View as Markdown

Perspective - Pie Chart

The default Pie Chart component when dragged onto a view.

Component Palette Icon:

The Pie Chart component icon within the Component Palette.

The Pie Chart component displays a list of named items, each of which has a value that is part of a total. The total is the sum of the value of each item. The key to the Pie Chart component is the data property, which contains the items that will be displayed as pie wedges. It is fully customizable in its appearance, from colors, line widths, text styles, and more.

The Pie Chart component has three pre-configured variants:

  • Basic: Default layout described above.
  • Donut: Layout with a center hole for KPI labels.
  • Rose: Layout featuring equal-angle slices, with radii proportional to value.

Properties​

NameDescriptionProperty Type
dataData source for the chart. Each object within an array defines the name and value for a single pie section. See data properties for more.array
labelsControls the text labels displayed on or near each slice. See labels properties for more.object
centerLabelControls the label displayed in the center of a Donut chart.
  • visible: Whether to show the center label. Default is true (show).
  • primary: Main text displayed in the center of the pie chart. Usually a KPI value or total.
    • text: Primary center display text. Supports expressions.
    • fontSize: Primary center font size.
  • secondary: Smaller supporting text below the primary. Usually a label or unit of measure.
    • text: Secondary center display text. Supports expressions.
    • fontSize: Secondary center font size.
object
legendChart legend configuration. See legend properties for more.object
titleChart title and subtitle configuration and styling. See title properties.object
tooltipTooltip text shown on hover.
  • enabled: If true, tooltip text is shown on hover.
  • format: Your own tooltip text, replacing any default text. Leave empty for default tooltip text. Tokens include {name}, {sliceName}, {value}, and {percent}.
object
appearanceControls the chart visual theme, sizing, animation, and background. See appearance properties for more.object
styleUse styles to customize the visual style of the component. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class.object

data Properties​

The data object contains a flat array of individual slice objects. Each entry is a named category with a value. The component calculates proportions automatically, so there is no need to pre-compute percentages.

NameDescriptionProperty Type
nameName of the slice. This value is also displayed in the legend, tooltip, and slice labels. Referenced by the onClick event as event.name.string
valueNumeric value for the slice. Propertions are calculated automatically from the sum of all values.number
colorColor of the slice. Overrides appearance.colorPalette auto-assignment for this slice. Can be chosen from the color wheel, color palette, or entered as RGB or HSL value. See Color Selector. [optional]color

labels Properties​

The labels object supports rich label positioning, such as outside the slice, inside the slice, or as a callout line to the side of the slice.

NameDescriptionProperty Type
visibleWhether to show labels for each slice of this chart. Default is true (show).boolean
positionLabel placement relative to the slice. Default is outside.
  • outside: Label floats outside the slice.
  • inside: Label sits within the slice.
  • center: Label is centered in the slice. This is only readable on large slices.
string
contentWhat each label displays. Default is percent.
  • percent: A percentage.
  • value: A raw, numeric value.
  • name: Name of the slice only.
  • nameAndPercent: Name of the slice and a percentage. For example, Coal: 42.3%.
  • nameAndValue: Name of the slice and a raw, numeric value. For example, Coal: 142.
string
formatCustom format expression. Overrides the content property when not empty. Exposes {name}, {value}, and {percent} tokens.string
fontSizeFont size of slice labels in pixels.number
colorLabel text color. Defaults to the slice color when the position property is set to outside, and white when set to inside. Can be chosen from the color wheel, color palette, or entered as RGB or HSL value. See Color Selector.color
lineVisibleWhether to show the callout line connecting the slice to its outside label. Default is true (show). Only relevant when the position property is set to outside.boolean
elementStyleSets a style for this element. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class.object

legend Properties​

NameDescriptionProperty Type
visibleWhether to show the chart legend. Default is true (show).boolean
positionWhere the legend is anchored relative to the chart. Can be top, bottom, left, right.string
orientationDirection the items in the legend flow in. Can be horizontal or vertical.string
interactiveIf true, clicking a legend item toggles that slice's visibility. Default is true.boolean
fontSizeFont size of legend item labels in pixels.number
elementStyleSets a style for this element. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class.object

title Properties​

NameDescriptionProperty Type
visibleWhether to show or hide the chart title. Default is true (show).boolean
textChart title text.string
colorChart title text color. Takes precedence over elementStyle.color when both are set. Can be chosen from the color wheel, color palette, or entered as RGB or HSL value. See Color Selector.color
fontSizeFont size of the chart title text. Takes precedence over elementStyle.fontSize when both are set.number
subtitleSubtitle text displayed below the main chart title.
  • text: Subtitle text.
  • color: Subtitle text color.
  • fontSize: Font size of the subtitle text. Takes precedence over elementStyle.fontSize when both are set.
  • elementStyle: Sets a style for this element. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class.
object
positionPosition of the title within the chart.string
gapGap between the chart title and subtitle in pixels.number
elementStyleSets a style for this element. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class.object

appearance Properties​

NameDescriptionProperty Type
colorPaletteColors for each slice in the chart, arranged in the array order configured in the data property. Defaults to the Ignition theme palette for slices that do not have an explicit data.color.array
innerRadiusInner radius of the chart as a percentage of the outer radius, or absolute pixels. 0 renders a Pie, while any value greater than 0 renders a Donut.number
outerRadiusOuter radius of the slices as a percentage of the component container, or absolute pixels.number
centerXHorizontal center position of the chart, as a percentage of the component container.string
centerYVertical center position of the chart, as a percentage of the component container.string
borderRadiusCorner radius of each slice in pixels. A smaller value (e.g. 4) gives slices a rounded appearance.number
borderWidthWidth of the border between slices in pixels.number
borderColorColor of the border between slices.color
roseTypeIf true, enables Rose variant mode. Slices will have equal angles, but varying radii proportional to the slice value. Default is false for Pie and Donut, true for Rose.boolean
startAngleStarting angle of the first slice in degrees. Measured counterclockwise from the 3 o'clock position. 90 degrees starts at 12 o'clock.number
selectedModeDetermines how many slices can be selected at a time.
  • single: One slice can be selected at a time.
  • multiple: Any number of slices can be selected.
  • false: Selection disabled.
string
selectedOffsetHow far a selected slice is offset from the center in pixels.number
backgroundColorChart background fill color. Can be chosen from color wheel, chosen from color palette, or entered as RGB or HSL value. See Color Selector.color
animationIf true, enable entry and update animations. Default is true.boolean
animationDurationDuration of the initial render animation and the data change transition, in milliseconds.number

Component Events​

Further component interaction and functionality can be configured for all components through scripting and event actions. Right-click on the component or select Components from the Designer menubar to access the configuration popups for both of these options:

  • Configure Events: Accesses the Event Configuration popup where you can configure actions to run in response to events to make the component dynamic. The Events Configurations page shows how to configure events and actions on a Perspective component.

  • Configure Scripts: Accesses the Script Configuration popup where custom methods and message handlers can be added. The Scripting in Perspective section details scripting fundamentals, creating custom methods, and using message handlers.

The Pie Chart component also has Component Events associated with it. See the Perspective - Pie Chart Scripting page for more information.

Examples​

In the examples below, we'll be creating three different pie charts, one for each component variant.

  1. From the Perspective section of the Project Browser in your Designer, right-click on the Views folder and select New View... to create a new view. The New View popup will display.

  2. Give your view a name and ensure the Coordinate Root Container Type is selected. The Page URL setting will remain unchecked for this example.

Example of a New View popup, with default values selected.

  1. Click to expand the Perspective Components Palette, and click the Pie icon to display all Pie Chart variants.

  2. Drag and drop a Pie Chart variant onto your newly created view.

Proceed to one of examples below depending on your selection, and try entering the sample data into your component's properties to see how your chart changes.

note

In the Basic Pie Chart Example, the sample data provided contains the default values for this component.

Basic Pie Chart Example​

The following is an example of a Basic variant of the Pie Chart component. The sample data used to display this chart is listed below in JSON format.

An example of a Basic Pie Chart component.

{
"data": [
{"name": "Natural Gas", "value": 4850},
{"name": "Electricity", "value": 3920},
{"name": "Compressed Air", "value": 1240},
{"name": "Steam", "value": 980},
{"name": "Diesel", "value": 420}
{"name": "Other", "value": 175}
],
"labels": {
"visible": true,
"position": "outside",
"content": "percent",
"fontSize": 12,
"lineVisible": true
},
"centerLabel": {
"visible": false
},
"legend": {
"visible": true,
"position": "bottom",
"orientation": "horizontal",
"interactive": true
},
"appearance": {
"innerRadius": 0,
"outerRadius": "55%",
"centerX": "50%",
"centerY": "50%",
"borderRadius": 0,
"selectedMode": "single",
"selectedOffset": 10,
"animation": true,
"tooltip": { "enabled": true }
}
}

Donut Pie Chart Example​

The following is an example of a Donut variant of the Pie Chart component. The sample data used to display this chart is listed below in JSON format.

An example of a Donut Pie Chart component.

{
"data": [
{ "name": "Coal", "value": 142, "color": "#1A5FAD" },
{ "name": "Natural Gas", "value": 98, "color": "#2B7EC1" },
{ "name": "Renewables", "value": 67, "color": "#18B4B4" },
{ "name": "Nuclear", "value": 41, "color": "#1BBD96" },
{ "name": "Other", "value": 23, "color": "#2DB87A" }
],
"labels": {
"visible": true,
"position": "outside",
"content": "nameAndPercent",
"fontSize": 12,
"lineVisible": true
},
"centerLabel": {
"visible": true,
"primaryText": "371",
"primaryFontSize": 28,
"secondaryText": "Total",
"secondaryFontSize": 14
},
"legend": {
"visible": true,
"position": "bottom",
"orientation": "horizontal",
"interactive": true
},
"appearance": {
"innerRadius": "55%",
"outerRadius": "75%",
"centerX": "50%",
"centerY": "50%",
"borderRadius": 4,
"selectedMode": "single",
"selectedOffset": 10,
"animation": true,
"tooltip": { "enabled": true }
}
}

Rose Pie Chart Example​

The following is an example of a Rose variant of the Pie Chart component. The sample data used to display this chart is listed below in JSON format.

An example of a Rose Pie Chart component.

{
"data": [
{ "name": "Coal", "value": 142, "color": "#1A5FAD" },
{ "name": "Natural Gas", "value": 98, "color": "#2B7EC1" },
{ "name": "Renewables", "value": 67, "color": "#18B4B4" },
{ "name": "Nuclear", "value": 41, "color": "#1BBD96" },
{ "name": "Other", "value": 23, "color": "#2DB87A" }
],
"labels": {
"visible": true,
"position": "outside",
"content": "nameAndPercent",
"fontSize": 12,
"lineVisible": true
},
"centerLabel": {
"visible": true,
"primaryText": "371",
"primaryFontSize": 28,
"secondaryText": "Total",
"secondaryFontSize": 14
},
"legend": {
"visible": true,
"position": "bottom",
"orientation": "horizontal",
"interactive": true
},
"appearance": {
"innerRadius": "45%",
"outerRadius": "75%",
"centerX": "50%",
"centerY": "50%",
"borderRadius": 4,
"roseType": true,
"selectedMode": "single",
"selectedOffset": 10,
"animation": true,
"tooltip": { "enabled": true }
}
}