⮪ DonutChartView
July 18, 2024 · View on GitHub
A SKCanvasView used to render customisable donut charts.
public class DonutChartView : SKCanvasView, IPadding
Inheritance: Object -> BindableObject -> Element -> NavigableElement -> VisualElement -> View -> SKCanvasView -> DonutChartView
Implements: IPadding
Events
| Name | Type | Description |
|---|---|---|
| EntryClicked | EntryClickEventArgs | Raised whenever a segment on the chart is clicked. |
Properties
| Name | Type | Bindable | Default | Description |
|---|---|---|---|---|
| EntriesSource | IEnumerable | ✅ | An empty ObservableCollection<object> | The source of entry data to be used for rendering the chart. It is expected that these entries be some sort of class with value and label properties. |
| EntryValuePath | string | ✅ | "Value" | The path of the value property (expected to be of type float) to be used for determining each entry's segment size. |
| EntryLabelPath | string | ✅ | "Label" | The path of the label property (expected to be of type string) to be used for a friendly display for each entry. |
| EntryImageTemplate | DataTemplate? | ✅ | null | The template to be used for rendering the image for each data entry. This template's resulting view is expected to be a FileImageSource. |
| EntryImageScale | float | ✅ | 0.1f | The scale to apply to the rendered entry image. |
| EntryColors | Color[] | ✅ | Blue, Green, Yellow, Purple, Orange | The colors to use for representing each data entry on the chart. These colors will loop if there are more entries than colors. |
| EntryClickedCommand | ICommand? | ✅ | null | The command to be invoked when an entry is clicked. This command will receive an object parameter which represents the clicked entry. |
| EntrySpacing | float | ✅ | 10f | The spacing to be rendered between each entry segment on the chart. Currently, anything over 20f may produce unexpected results. |
| Padding | Thickness | ✅ | 10, 10, 10, 10 | The padding applied to the entire view. |
| ChartRotationDegrees | float | ✅ | 90f | The rotation offset to be applied to the chart. |
| ChartOuterRadius | float | ✅ | 250f | The radius of the outside ring of the chart. |
| ChartInnerRadius | float | ✅ | 125f | The radius of the inside ring of the chart. |
| LabelStyle | LabelStyle | ✅ | LabelStyle.Key | The style in which to display labels on the chart. |
| LabelFontFamily | string | ✅ | "Arial" | The system font family to be used for rendering label text. |
| LabelFontColor | Color | ✅ | White | The color used for rendering label text. |
| LabelUseAutoFontColor | bool | ✅ | false | Determines if each entry's color will be used to render the corresponding label text or not. |
| LabelFontSize | float | ✅ | 20f | The size used for rendering label text. |
| LabelKeySpacing | float | ✅ | 10f | The amount of vertical spacing between each label when LabelStyle is set to LabelStyle.Key. |
| LabelKeyColorOffset | float | ✅ | 20f | The amount of horizontal spacing between each label and its corresponding color when LabelStyle is set to LabelStyle.Key. |
| LabelOutsideRadius | float | ✅ | 50f | The radius from the ChartOuterRadius where entry labels will be rendered when LabelStyle is set to LabelStyle.Outside. |