I'm having trouble changing the colors of the pie chart sections in SpreadsheetGear. Normally, for a bar chart, I'm able to reference each section and set the interior color:
SpreadsheetGear.Charts.ISeries sumSeries = chart.SeriesCollection[0];
sumSeries.Format.Fill.ForeColor.RGB = red;
SpreadsheetGear.Charts.ISeries sumSeriesTwo = chart.SeriesCollection[1];
sumSeriesTwo .Format.Fill.ForeColor.RGB = blue;
With the pie chart, there is only one SeriesCollection so I'm not able to reference the other sections of the chart even though there are 5 different sections in the pie chart:
series = chart.SeriesCollection[0];
seriesTwo = chart.SeriesCollection[1]; // out of range
How can I change the color of the other sections in the pie chart?
The slices of a pie chart are individual data points in a single series (a collection of IPoint objects in ISeries.Points[...]), so you would need to modify each IPoint in that first series to affect each slice's color. Example:
ISeries series = chart.SeriesCollection[0];
series.Points[0].Format.Fill.ForeColor.RGB = SpreadsheetGear.Colors.Red;
series.Points[1].Format.Fill.ForeColor.RGB = SpreadsheetGear.Colors.Green;
series.Points[2].Format.Fill.ForeColor.RGB = SpreadsheetGear.Colors.Blue;