NestedDoughnutSeriesView Class
Represents a series view of the Nested Doughnut type.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.1.dll
NuGet Package: DevExpress.Charts
Declaration
[TypeConverter(typeof(NestedDoughnutSeriesViewTypeConverter))]
public class NestedDoughnutSeriesView :
DoughnutSeriesView,
INestedDoughnutSeriesView,
ISupportSeriesGroups
Remarks
The NestedDoughnutSeriesView class provides the functionality of a series view of the Nested Doughnut type within a chart control.
In addition to the common view settings inherited from the PieSeriesViewBase class, the NestedDoughnutSeriesView class declares the Nested Doughnut type specific settings. The settings allow you to define an inner indent between nested doughnuts (NestedDoughnutSeriesView.InnerIndent), specify the specific weight for each nested doughnut series (NestedDoughnutSeriesView.Weight), and create groups for similar Nested Doughnut series (NestedDoughnutSeriesView.Group).
Note that a particular view type can be defined for a series via its SeriesBase.View property.
For more information on series views of the pie type, see the Nested Doughnut topic.
Example
The following example demonstrates how to create a ChartControl with a series of the NestedDoughnutSeriesView
type, set its general properties, and add this chart to a form at runtime. Before proceeding with this example, create a Windows Forms Application in Visual Studio, and add all required assemblies in the References list of your project.
Then, add the following code to the Form.Load event handler.
using System;
using System.Windows.Forms;
using DevExpress.Utils;
using DevExpress.XtraCharts;
namespace NestedDoughnut {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e) {
// Create a new chart.
ChartControl NestedDoughnutChart = new ChartControl();
// Add the chart to the form.
NestedDoughnutChart.Dock = DockStyle.Fill;
this.Controls.Add(NestedDoughnutChart);
// Create a first nested doughnut series.
Series series1 = new Series("Male", ViewType.NestedDoughnut);
// Populate the series with points.
series1.Points.Add(new SeriesPoint("0-14 years", 29.956));
series1.Points.Add(new SeriesPoint("15-64 years", 25.607));
series1.Points.Add(new SeriesPoint("65 years and older", 13.493));
// Add the first series to the chart.
NestedDoughnutChart.Series.Add(series1);
// Create a second nested doughnut series.
Series series2 = new Series("Female", ViewType.NestedDoughnut);
// Populate the series with points.
series2.Points.Add(new SeriesPoint("0-14 years", 90.354));
series2.Points.Add(new SeriesPoint("15-64 years", 55.793));
series2.Points.Add(new SeriesPoint("65 years and older", 48.983));
// Add the second series to the chart.
NestedDoughnutChart.Series.Add(series2);
// Specify the hole radius percentage and inner indent of the nested doughnut.
((NestedDoughnutSeriesView)series1.View).InnerIndent = 8;
((NestedDoughnutSeriesView)series1.View).HoleRadiusPercent = 30;
// Specify the legend text pattern for the first series.
series1.LegendTextPattern = "{A}";
// Hide a legend for the second series.
series2.ShowInLegend = false;
// Enable a tooltip and specify the tooltip point pattern for series.
NestedDoughnutChart.ToolTipEnabled = DefaultBoolean.True;
series1.ToolTipPointPattern = "{S}:{VP:##.##%}";
series2.ToolTipPointPattern = "{S}:{VP:##.##%}";
// Hide series labels.
series1.LabelsVisibility = DefaultBoolean.False;
series2.LabelsVisibility = DefaultBoolean.False;
// Add a title to the chart.
ChartTitle chartTitle1 = new ChartTitle();
chartTitle1.Text = "Nested Doughnut Chart";
NestedDoughnutChart.Titles.Add(chartTitle1);
}
}
}