buy now
log in

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(); 

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

Copyright © 2001-2019 MindFusion LLC. All rights reserved.
Terms of Use - Contact Us