Is there a way to set each pie slice in a series to specific colors using FreeSpireXls C#?
I am working with your example Pie in C#, and I do not see an example on how to set slice colors programmatically.
Thanks
ChartSerie sers = sheet.Charts[0].Series[0];
int datapoints= sers.Values.Count;
for (int i = 0; i < datapoints; i++)
{
switch (i.ToString())
{
case "0":
sers.DataPoints[i].DataFormat.Fill.ForeColor = Color.Red;
break;
case "1":
sers.DataPoints[i].DataFormat.Fill.ForeColor = Color.Yellow;
break;
case "2":
sers.DataPoints[i].DataFormat.Fill.ForeColor = Color.Green;
break;
case "3":
sers.DataPoints[i].DataFormat.Fill.ForeColor = Color.Blue;
break;
case "4":
sers.DataPoints[i].DataFormat.Fill.ForeColor = Color.Black;
break;
}
}