Skip to main content

Configuring Pie Chart Panels

1. Setting Chart Type

Property Values Description
panel.type piechart Sets the panel type to display pie chart visualization

Example: Panel Configuration

{
  "type": "piechart",
  "title": "Pie Chart Example"
}

2. Configuring Legend Display

Property Values Description
legend.show true | false Controls whether the legend is displayed. Default: true
legend.position right | bottom | left | top Position of the legend relative to the chart. Default: right
legend.calcs Array of calculation types Calculations to display in the legend. Options: mean, sum, count, min, max
legend.values true | false Whether to show values in the legend. Default: false

Example: Configure Legend Position and Values

{
  "legend": {
    "show": true,
    "position": "bottom",
    "values": true,
    "calcs": ["mean", "sum"]
  }
}

3. Setting Value Display

Property Description Values Notes
valueName Controls how the value is displayed in the pie chart name, value, percent Default is name
legend.show Whether to show the legend for the pie chart true, false Default is true
legend.values Whether to display value or percentage in legend true, false Default is false
legend.percentageDecimals Number of decimal places for percentage display in legend 0-10 Default is 2

Example: Configure Value Display in Pie Chart Panel

{
  "panels": [
    {
      "id": 1,
      "type": "piechart",
      "title": "Sample Pie Chart",
      "legend": {
        "show": true,
        "values": true,
        "percentageDecimals": 1
      },
      "valueName": "percent"
    }
  ]
}

4. Configuring Label Display

Property Description Values Notes
legend.show Controls visibility of the legend true / false Default: true
legend.values Whether to display values in the legend true / false Default: false
legend.percentage Whether to display percentages in the legend true / false Default: false
legend.sort Sort order of legend items asc, desc, none Default: none
legend.sortBy Sort key for legend items name, value, percent Default: name

Example: Legend Configuration

{
  "legend": {
    "show": true,
    "values": true,
    "percentage": true,
    "sort": "desc",
    "sortBy": "value"
  }
}

5. Using Reduce Options

Option Description Values Notes
reduceOptions Configuration for reducing data points in a pie chart { values: boolean, limit: number, calculate: string } Used to aggregate or limit data points in pie charts

Example: Reduce Options Configuration

{
  "values": true,
  "limit": 10,
  "calculate": "sum"
}
Note: The reduceOptions can be used to aggregate multiple data series into a single value for display in the pie chart.

6. Configuring Tooltip Content

Property Description Values Notes
tooltip.mode Defines how tooltip content is displayed single, multi, none Default: single
tooltip.sort Sorts data points in tooltip none, asc, desc Default: none
tooltip.valueType Specifies value format in tooltip individual, percent, total Default: individual

Example: Tooltip Configuration

{
  "tooltip": {
    "mode": "multi",
    "sort": "desc",
    "valueType": "percent"
  }
}
Note: The valueType setting affects how values are displayed in the tooltip. For example, percent shows each slice as a percentage of the total.

7. Setting Color Scheme

Property Values Description
colorScheme "blue", "green", "red", "yellow", "purple", "orange", "pink", "indigo", "teal", "cyan" Predefined color palette for pie chart segments
customColors ["#FF0000", "#00FF00", "#0000FF"] Custom color array for pie chart segments
colorMode "spectrum", "fixed" Determines how colors are applied to segments

Example: Custom Color Scheme

{
  "colorScheme": "custom",
  "customColors": [
    "#FF5733",
    "#33FF57",
    "#3357FF"
  ],
  "colorMode": "spectrum"
}
Note: When using colorMode: "fixed", each segment will use a color from the customColors array in order, cycling back to the start if there are more segments than colors.

8. Using Value Mappings

Property Description Example
value mappings Map numeric values to text labels or colors
[
  {
    "id": "1",
    "operator": "",
    "text": "Critical",
    "value": "0"
  },
  {
    "id": "2",
    "operator": "",
    "text": "Warning",
    "value": "1"
  }
]

Example: Value Mapping Configuration

{
  "fieldConfig": {
    "overrides": [
      {
        "matcher": {
          "id": "byName",
          "options": "status"
        },
        "properties": [
          {
            "id": "custom.valueMappings",
            "value": [
              {
                "text": "OK",
                "value": "0"
              },
              {
                "text": "Warning",
                "value": "1"
              },
              {
                "text": "Critical",
                "value": "2"
              }
            ]
          }
        ]
      }
    ]
  }
}

9. Setting Pie Size

Property Values Description
pieType "pie" | "donut" Sets the pie chart type. "pie" for standard pie charts, "donut" for donut charts.
radius number Determines the radius of the pie chart in pixels. Default is usually 100.
innerRadius number Defines the inner radius for donut charts. Set to 0 for pie charts.

Example: Configuring Pie Size

{
  "pieType": "donut",
  "radius": 120,
  "innerRadius": 40
}

10. Configuring Donut Hole Size

Property Values Description
donut.holeSize 0.5 Controls the size of the hole in the center of the donut chart. Value is a decimal between 0 and 1, where 0 means no hole and 1 means the entire chart is hole.

Example: Setting Donut Hole Size

{
  "donut": {
    "holeSize": 0.7
  }
}

Was this article helpful?