.NET Framework Developer Center >
.NET Development Forums
>
Chart Controls for .NET Framework
>
About 2D Grouped Pie Chart and 3D Stacked Pie Chart ?>
About 2D Grouped Pie Chart and 3D Stacked Pie Chart ?>
- Hello everyone, I am a beginner.
Effect Picture:
This effect how to achieve?Microsoft Chart demo did not achieve the? Thank you very much.
Answers
- Hello my beginner friend.
In this example 2 things are done which you need to refer :
1) Multiple series alignment in same chart area of the chart control
and
2) Custom properties for Pie and doughnut charts.
Play with the chart controls, I am sure if you are done with above two things, you will achieve the given look n feel.
Hope, I would be helpful.
If you find solution from my answer, please mark it as answer- Marked As Answer byBruse Lee Monday, November 09, 2009 1:46 AM
- You need to create two Pie/Doughnut chart areas on top of each other. Look at the example in this thread .
- Marked As Answer byBruse Lee Monday, November 09, 2009 1:46 AM
All Replies
- Hello my beginner friend.
In this example 2 things are done which you need to refer :
1) Multiple series alignment in same chart area of the chart control
and
2) Custom properties for Pie and doughnut charts.
Play with the chart controls, I am sure if you are done with above two things, you will achieve the given look n feel.
Hope, I would be helpful.
If you find solution from my answer, please mark it as answer- Marked As Answer byBruse Lee Monday, November 09, 2009 1:46 AM
- I think you are right! but Multiple series alignment in same chart area of the chart control,How to simultaneously display two pie chart? How to set the property?Set radius, or the location of?
- You need to create two Pie/Doughnut chart areas on top of each other. Look at the example in this thread .
- Marked As Answer byBruse Lee Monday, November 09, 2009 1:46 AM
- Thank you Dhruv Patel




Let me clear thinking!
Thank you sipla ! I tried it .Very good!
The c# code:
using System; using System.Collections.Generic; using System.Linq; using System.Drawing; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.DataVisualization.Charting; public partial class Forms_Charts_Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Chart1.ChartAreas.Clear(); Chart1.Series.Clear(); Chart1.Legends.Clear(); float baseDoughnutWidth = 25; //values 0 to 99 //Create the outer area float outerSize = 100; //percent ChartArea outerArea = new ChartArea("OUTER_AREA"); outerArea.Position = new ElementPosition(0, 0, 100, 100); //Set the plot position to the middle of the area depending on the size outerArea.InnerPlotPosition = new ElementPosition((100 - outerSize) / 2, (100 - outerSize) / 2, outerSize, outerSize); outerArea.BackColor = Color.Transparent; //Add the area to the chart Chart1.ChartAreas.Add(outerArea); //Create the inner area float innerSize = 65; //percent ChartArea innerArea = new ChartArea("INNER_AREA"); innerArea.Position = new ElementPosition(0, 0, 100, 100); innerArea.InnerPlotPosition = new ElementPosition((100 - innerSize) / 2, (100 - innerSize) / 2, innerSize, innerSize); innerArea.BackColor = Color.Transparent; Chart1.ChartAreas.Add(innerArea); //Create the outer series Series outerSeries = new Series("OUTER_SERIES"); outerSeries.ChartArea = "OUTER_AREA"; outerSeries.ChartType = SeriesChartType.Doughnut; //Since the areas are different size, the width of each dougnut have to be set in proportion to the //size of the area in order to get the doughnut widths the same. outerSeries["DoughnutRadius"] = Math.Min(baseDoughnutWidth * (100 / outerSize), 99).ToString().Replace(",", "."); outerSeries.Palette = ChartColorPalette.Pastel; //Add points to the series outerSeries.Points.AddY(1); outerSeries.Points.AddY(2); outerSeries.Points.AddY(3); outerSeries.Points.AddY(4); //Add the series to the chart Chart1.Series.Add(outerSeries); //Create the inner series Series innerSeries = new Series("INNER_SERIES"); innerSeries.ChartArea = "INNER_AREA"; innerSeries.ChartType = SeriesChartType.Doughnut; innerSeries["DoughnutRadius"] = Math.Min(baseDoughnutWidth * (100 / innerSize), 99).ToString().Replace(",", "."); innerSeries.Palette = ChartColorPalette.BrightPastel; // Chart1.Series.Add(innerSeries); innerSeries.Points.AddY(4); innerSeries.Points.AddY(3); innerSeries.Points.AddY(2); innerSeries.Points.AddY(1); Chart1.Series.Add(innerSeries); } }


