Skip to main content

Pie chart

info

Charts are available with Avalonia Pro.

Pie charts are circular charts divided into sectors to illustrate numerical proportion. They are most effective when showing part-to-whole relationships.

Pie chart divided into colored sectors showing proportional market share across a small number of categories.

When to use

  • Proportions: Visualizing the relative size of categories compared to the total.
  • Limited categories: Best used with 2-6 categories to maintain readability.
  • Composition: Showing how a total amount is divided among different segments.

Code example

XAML

<charts:PieChart Name="PieChartSample" IsTooltipEnabled="True" Title="Market Share" Height="300">
<charts:PieChart.Series>
<charts:PieSeries ItemsSource="{Binding PieChartData}" LabelPath="Value" />
</charts:PieChart.Series>
</charts:PieChart>

Data model (C#)

public ObservableCollection<double> PieChartData { get; } = new()
{
35, 25, 20, 15, 5
};

Common properties

PieChart

PropertyDescriptionDefault
InnerRadiusFactorCenter-hole size applied when a PieSeries does not set its own inner radius. Set a value greater than 0.0 to create a donut.0.0
PaletteCustom brush collection for the segments.Auto-generated

PieSeries

PropertyDescriptionDefault
ItemsSourceThe collection of data items.null
ValuePathPath to the property used for the segment values.null
LabelPathPath to the property used for segment labels.null
RadiusFactorOuter radius factor for the series, from 0.0 to 1.0.0.9
InnerRadiusFactorOptional inner radius factor for the series. When null, the chart-level value is used.null
StartAngleStart angle in degrees for the first slice.-90.0
ShowLabelsWhether to display labels on the slices.true
LabelPositionPosition of slice labels, Inside or Outside.Inside
SliceLabelFormatFormat used for slice labels.Percentage
LabelFontSizeFont size used for slice labels.11.0
LabelForegroundBrush used for slice labels.null