In This Article

PieSeries Class

Represents a pie series for use in a PieChart or DonutChart.

public class PieSeries : Control
Inheritance:
object Visual UIElement FrameworkElement Control object

Constructors

PieSeries()

Initializes an instance of the class.

public PieSeries()

Properties

AreChildLabelsVisible

Indicates whether child labels are visible or not.

public bool AreChildLabelsVisible { get; set; }

Property Value

bool

AreChildrenVisibleInLegend

Indicates whether children are visible in the legend or not.

public bool AreChildrenVisibleInLegend { get; set; }

Property Value

bool

AreLabelsVisible

Indicates whether labels are visible or not.

public bool AreLabelsVisible { get; set; }

Property Value

bool:

true if labels are visible; otherwise, false.

ChildLabelBrush

The brush used for child pie slice labels.

public Brush ChildLabelBrush { get; set; }

Property Value

Brush

Remarks

If ChildLabelBrush is not set, then LabelBrush will be used, or Foreground if neither are set.

ChildLabelPosition

The child label position.

public PieSliceLabelPosition ChildLabelPosition { get; set; }

Property Value

PieSliceLabelPosition

ChildLabelStyle

The style applied to child pie slice labels. Style should have TargetType of TextBlock.

public Style ChildLabelStyle { get; set; }

Property Value

Style

ChildSliceLabelFormat

The child slice label format.

public string ChildSliceLabelFormat { get; set; }

Property Value

string

Remarks

This property is ignored if ChildSliceLabelFunc is specified. The label format has three parameters: {0} is the percentage of the child pie slice. {1} is the original value of the child pie slice. {2} is the title of the child pie slice.

ChildSliceLabelFunc

The child slice label func.

public Func<double, object?, string?, string> ChildSliceLabelFunc { get; set; }

Property Value

Func<double, object, string, string>

Remarks

This is a custom function that takes the pie slice percentage, original value, and title as parameters and returns the label of your choice.

ChildSliceTitlePath

The child slice title path.

public string ChildSliceTitlePath { get; set; }

Property Value

string

Remarks

This is a path to a property on a value of child items that represents the title of the pie slice.

ChildSliceToolTipFormat

The child slice tooltip format.

public string ChildSliceToolTipFormat { get; set; }

Property Value

string

Remarks

This property is ignored if ChildSliceToolTipFunc is specified. The tooltip format has three parameters: {0} is the percentage of the child pie slice. {1} is the original value of the child pie slice. {2} is the title of the child pie slice.

ChildSliceToolTipFunc

The child slice tooltip func.

public Func<double, object?, string?, string> ChildSliceToolTipFunc { get; set; }

Property Value

Func<double, object, string, string>

Remarks

This is a custom function that takes the pie slice percentage, original value, and title as parameters and returns the tooltip of your choice.

ChildSliceValuePath

The child slice value path.

public string ChildSliceValuePath { get; set; }

Property Value

string

Remarks

This is a path to a property on a value of child items that represents the value of the pie slice.

ChildrenLength

The length of the children.

public double ChildrenLength { get; set; }

Property Value

double

Remarks

Length is the size of children in relation to the other pie series.

ChildrenPath

The children path.

public string ChildrenPath { get; set; }

Property Value

string

Remarks

This is a path to a property on a value in ItemsSource that is an IEnumerable containing child data.

ChildrenPosition

The children position.

public PieSeriesChildPosition ChildrenPosition { get; set; }

Property Value

PieSeriesChildPosition

IsOtherThresholdPercent

A value indicating whether this instance is other threshold percent.

public bool IsOtherThresholdPercent { get; set; }

Property Value

bool:

true if this instance is other threshold percent; otherwise, false.

IsVisibleInLegend

A value indicating whether this instance is visible in legend.

public bool IsVisibleInLegend { get; set; }

Property Value

bool:

true if this instance is visible in legend; otherwise, false.

ItemsSource

The items source.

public IEnumerable ItemsSource { get; set; }

Property Value

IEnumerable

LabelBrush

The brush used for labels.

public Brush LabelBrush { get; set; }

Property Value

Brush

Remarks

If LabelBrush is not set, then Foreground will be used instead.

LabelInsideFitMode

The label inside fit mode.

public PieSliceLabelInsideFitMode LabelInsideFitMode { get; set; }

Property Value

PieSliceLabelInsideFitMode

Remarks

This determines how the label reacts when it doesn't fit inside the pie slice.

LabelPosition

The label position.

public PieSliceLabelPosition LabelPosition { get; set; }

Property Value

PieSliceLabelPosition

LabelStyle

The style applied to pie slice labels. Style should have TargetType of TextBlock.

public Style LabelStyle { get; set; }

Property Value

Style

Length

The size of pie series in relation to the other pie series.

public double Length { get; set; }

Property Value

double

OtherThreshold

The threshold for the "Other" slice.

public double OtherThreshold { get; set; }

Property Value

double

Remarks

If IsOtherThresholdPercent is true, then this value represents a percentage between 0.0 and 1.0. Otherwise, it represents a numerical value. All values beneath the other threshold will be aggregated into an "Other" pie slice.

SliceLabelFormat

The slice label format.

public string SliceLabelFormat { get; set; }

Property Value

string

Remarks

This property is ignored if SliceLabelFunc is specified. The label format has three parameters: {0} is the percentage of the pie slice. {1} is the original value of the pie slice. {2} is the title of the pie slice.

SliceLabelFunc

The slice label func.

public Func<double, object?, string?, string> SliceLabelFunc { get; set; }

Property Value

Func<double, object, string, string>

Remarks

This is a custom function that takes the pie slice percentage, original value, and title as parameters and returns the label of your choice.

SliceStyleSelector

The slice style selector, which determines the style used for each pie slice.

public IPieSliceStyleSelector SliceStyleSelector { get; set; }

Property Value

IPieSliceStyleSelector

SliceTitlePath

The slice title path.

public string SliceTitlePath { get; set; }

Property Value

string

Remarks

This is a path to a property on a value in ItemsSource that represents the value of the pie slice.

SliceToolTipFormat

The slice tooltip format.

public string SliceToolTipFormat { get; set; }

Property Value

string

Remarks

This property is ignored if SliceToolTipFunc is specified. The tooltip format has three parameters: {0} is the percentage of the pie slice. {1} is the original value of the pie slice. {2} is the title of the pie slice.

SliceToolTipFunc

The slice tooltip func.

public Func<double, object?, string?, string> SliceToolTipFunc { get; set; }

Property Value

Func<double, object, string, string>

Remarks

This is a custom function that takes the pie slice percentage, original value, and title as parameters and returns the tooltip of your choice.

SliceValuePath

The slice value path.

public string SliceValuePath { get; set; }

Property Value

string

Remarks

This is a path to a property on a value in ItemsSource that represents the value of the pie slice.

Methods

FireRefresh()

Fires the Refresh event.

protected void FireRefresh()

OnItemsSourceChanged(IEnumerable?, IEnumerable?)

Occurs when the ItemsSource value is changed.

protected virtual void OnItemsSourceChanged(IEnumerable? oldValue, IEnumerable? newValue)
Parameter Type Description
oldValue IEnumerable

Old value of the ItemsSource property.

newValue IEnumerable

New value of the ItemsSource property.

OnItemsSourceCollectionChanged(object?, NotifyCollectionChangedEventArgs)

Handles the CollectionChanged event of the ItemsSource collection.

protected virtual void OnItemsSourceCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
Parameter Type Description
sender object

The source of the event.

e NotifyCollectionChangedEventArgs

The event data.

Events

Refresh

Occurs when a property on pie series is changed that requires the pie chart to be refreshed.

public event EventHandler? Refresh

Event Type

EventHandler

Fields

AreChildLabelsVisibleProperty

Defines the AreChildLabelsVisible property.

public static readonly DependencyProperty AreChildLabelsVisibleProperty

AreChildrenVisibleInLegendProperty

Defines the AreChildrenVisibleInLegend property.

public static readonly DependencyProperty AreChildrenVisibleInLegendProperty

AreLabelsVisibleProperty

Defines the AreLabelsVisible property.

public static readonly DependencyProperty AreLabelsVisibleProperty

ChildLabelBrushProperty

Defines the ChildLabelBrush property.

public static readonly DependencyProperty ChildLabelBrushProperty

ChildLabelPositionProperty

Defines the ChildLabelPosition property.

public static readonly DependencyProperty ChildLabelPositionProperty

ChildLabelStyleProperty

Defines the ChildLabelStyle property.

public static readonly DependencyProperty ChildLabelStyleProperty

ChildLengthProperty

Defines the ChildrenLength property.

public static readonly DependencyProperty ChildLengthProperty

ChildPositionProperty

Defines the ChildrenPosition property.

public static readonly DependencyProperty ChildPositionProperty

ChildSliceLabelFormatProperty

Defines the ChildSliceLabelFormat property.

public static readonly DependencyProperty ChildSliceLabelFormatProperty

ChildSliceLabelFuncProperty

Defines the ChildSliceLabelFunc property.

public static readonly DependencyProperty ChildSliceLabelFuncProperty

ChildSliceTitlePathProperty

Defines the ChildSliceTitlePath property.

public static readonly DependencyProperty ChildSliceTitlePathProperty

ChildSliceToolTipFormatProperty

Defines the ChildSliceToolTipFormat property.

public static readonly DependencyProperty ChildSliceToolTipFormatProperty

ChildSliceToolTipFuncProperty

Defines the ChildSliceToolTipFunc property.

public static readonly DependencyProperty ChildSliceToolTipFuncProperty

ChildValuePathProperty

Defines the ChildSliceValuePath property.

public static readonly DependencyProperty ChildValuePathProperty

ChildrenPathProperty

Defines the ChildrenPath property.

public static readonly DependencyProperty ChildrenPathProperty

IsOtherThresholdPercentProperty

Defines the IsOtherThresholdPercent property.

public static readonly DependencyProperty IsOtherThresholdPercentProperty

IsVisibleInLegendProperty

Defines the IsVisibleInLegend property.

public static readonly DependencyProperty IsVisibleInLegendProperty

ItemsSourceProperty

Defines the ItemsSource property.

public static readonly DependencyProperty ItemsSourceProperty

LabelBrushProperty

Defines the LabelBrush property.

public static readonly DependencyProperty LabelBrushProperty

LabelInsideFitModeProperty

Defines the LabelInsideFitMode property.

public static readonly DependencyProperty LabelInsideFitModeProperty

LabelPositionProperty

Defines the LabelPosition property.

public static readonly DependencyProperty LabelPositionProperty

LabelStyleProperty

Defines the LabelStyle property.

public static readonly DependencyProperty LabelStyleProperty

LengthProperty

Defines the Length property.

public static readonly DependencyProperty LengthProperty

OtherThresholdProperty

Defines the OtherThreshold property.

public static readonly DependencyProperty OtherThresholdProperty

SliceLabelFormatProperty

Defines the SliceLabelFormat property.

public static readonly DependencyProperty SliceLabelFormatProperty

SliceLabelFuncProperty

Defines the SliceLabelFunc property.

public static readonly DependencyProperty SliceLabelFuncProperty

SliceStyleSelectorProperty

Defines the SliceStyleSelector property.

public static readonly DependencyProperty SliceStyleSelectorProperty

SliceTitlePathProperty

Defines the SliceTitlePath property.

public static readonly DependencyProperty SliceTitlePathProperty

SliceToolTipFormatProperty

Defines the SliceToolTipFormat property.

public static readonly DependencyProperty SliceToolTipFormatProperty

SliceToolTipFuncProperty

Defines the SliceToolTipFunc property.

public static readonly DependencyProperty SliceToolTipFuncProperty

SliceValuePathProperty

Defines the SliceValuePath property.

public static readonly DependencyProperty SliceValuePathProperty

Extension Methods