Shop
Anmelden
MindFusion

Q: I want to color pieces in the pie chart differently and I want to change the pen for each piece. How do I do this with your tool?

A: Each PieSeries has properties that are used when the pieces are drawn – those are Fills and Strokes. The position of the Brush in these arrays correspond to the position of the data this piece represents in the Data array of the pie. If the brushes are less than the count of the pieces, the control cycles through them. Always initialize the Fills and Strokes collections or assign them lists with the desired brushes.

 PieSeries series = pieChart1.Series[0] as PieSeries;
 //initialize the Strokes property
 series.Strokes = new List(); 
 series.Strokes.Add(Brushes.Red);
 series.Strokes.Add(Brushes.Yellow);
 series.Strokes.Add(Brushes.Orange);

 //make the lines thicker
 series.StrokeThickness = 2;
 
 List fills = new List();
 fills.Add(Brushes.Green);
 fills.Add(Brushes.Blue);
 //assign the list to the Fills property
 series.Fills = fills;



Copyright © 2001-2024 MindFusion LLC. Alle Rechte vorbehalten.
Nutzungsbedingungen - Kontakt