DonutSeriesView Class
Displays series data points as a Donut chart.
Namespace: DevExpress.WinUI.Charts
Assembly: DevExpress.WinUI.Charts.v21.1.dll
Declaration
Remarks
Define the Series.View property to assign a specific view to the series.
Example
The following example shows how to create a Donut chart:
<Page
x:Class="PieChartSample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PieChartSample"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Charts="using:DevExpress.WinUI.Charts"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.DataContext>
<local:ChartViewModel/>
</Page.DataContext>
<Grid>
<Charts:PieChart x:Name="chart" ToolTipEnabled="True">
<Charts:PieChart.Legend>
<Charts:Legend HorizontalPosition="RightOutside"
VerticalPosition="Center"
Orientation="Horizontal"
MaximumRowsOrColumns="1"/>
</Charts:PieChart.Legend>
<Charts:PieChart.Series>
<Charts:Series x:Name="series">
<Charts:Series.View>
<Charts:DonutSeriesView ToolTipPointPattern="{}{A}: {VP:p}"
LegendPointPattern="{}{A} (${V}K)"
ShowLabels="True"
HoleRadiusPercent="60">
<Charts:DonutSeriesView.Title>
<Charts:SeriesTitle Content="Sales Volume by Products" Margin="10"/>
</Charts:DonutSeriesView.Title>
<Charts:DonutSeriesView.LabelOptions>
<Charts:SeriesLabelOptions Pattern="{}{VP:p}"
Charts:PieSeriesView.LabelPosition="TwoColumns"/>
</Charts:DonutSeriesView.LabelOptions>
</Charts:DonutSeriesView>
</Charts:Series.View>
<Charts:Series.Data>
<Charts:DataSourceAdapter DataSource="{Binding DataPoints}">
<Charts:DataMember DataMemberType="Argument" ColumnName="Product" />
<Charts:DataMember DataMemberType="Value" ColumnName="Income" />
</Charts:DataSourceAdapter>
</Charts:Series.Data>
</Charts:Series>
</Charts:PieChart.Series>
</Charts:PieChart>
</Grid>
</Page>
using DevExpress.Mvvm;
using Microsoft.UI.Xaml.Controls;
using System.Collections.Generic;
namespace PieChartSample {
public sealed partial class MainPage : Page {
public MainPage() {
this.InitializeComponent();
}
}
public class DataPoint {
public string Product { get; set; }
public double Income { get; set; }
}
public class ChartViewModel : ViewModelBase {
public ChartViewModel() {
List<DataPoint> dataPoints = new List<DataPoint> {
new DataPoint() { Product = "Camera", Income = 78 },
new DataPoint() { Product = "Flash", Income = 92 },
new DataPoint() { Product = "Smartphone", Income = 43 },
new DataPoint() { Product = "Tripod", Income = 98 },
new DataPoint() { Product = "Mobile Phone", Income = 70 },
new DataPoint() { Product = "Smart Watch", Income = 98 },
new DataPoint() { Product = "Laptop", Income = 85 },
new DataPoint() { Product = "Tablet", Income = 99 },
new DataPoint() { Product = "Headphone", Income = 94 }
};
DataPoints = dataPoints;
}
public List<DataPoint> DataPoints { get; }
}
}
For step-by-step instructions on how to create a Pie chart, refer to the following help topic: Lesson 2 - Create a Pie Chart.
Inheritance
See Also