Theme colors for Charts

Is there possible to create a custom theme of colors to use in charts?

Hi Peter,

GemBox.Spreadsheet currently doesn’t have API for setting theme colors.

However, you can customize chart colors by setting them explicitly to some desired value, see the Chart Formatting example.

I hope this helps.

Regards,
Mario

Is it possible to change the colors of the pie charts?

Yes, here is how you could set the colors of the Pie chart:

var workbook = ExcelFile.Load("Chart.xlsx");
var worksheet = workbook.Worksheets[0];
        
var pieChart = worksheet.Charts.OfType<PieChart>().First();
var points = pieChart.Series[0].DataPoints;
        
int count = points.Count();
int colorRate = 255 / count;

for (int i = 0; i < count; i++)
{
    var point = points[i];
    var color = DrawingColor.FromRgb(colorRate * (i + 1), colorRate * (i + 1), colorRate * (i + 1));
    point.Fill.SetSolid(color);
}

workbook.Save("Chart_Saved.xlsx");