Hi all,
I'm trying to set the color of ech slice of a pie chart via following code
bool trueFalse = true;
for (int i = 0; i < excel.Worksheets[0].Charts[0].NSeries.Count; i++)
{
datalabels = excel.Worksheets[0].Charts[0].NSeries[i].DataLabels;
datalabels.IsCategoryNameShown = true;
datalabels.IsValueShown = false;
datalabels.IsPercentageShown = true;
for (int k = 0; k < excel.Worksheets[0].Charts[0].NSeries[i].Points.Count; k++)
{
if (trueFalse)
{
excel.Worksheets[0].Charts[0].NSeries[i].Points[k].Area.BackgroundColor = System.Drawing.Color.Blue;
excel.Worksheets[0].Charts[0].NSeries[i].Points[k].Area.ForegroundColor = System.Drawing.Color.Blue;
}
else
{
excel.Worksheets[0].Charts[0].NSeries[i].Points[k].Area.BackgroundColor = System.Drawing.Color.Gray;
excel.Worksheets[0].Charts[0].NSeries[i].Points[k].Area.ForegroundColor = System.Drawing.Color.Gray;
}
trueFalse = !trueFalse;
}
}
It has no effect and I cannot figure why. Any help on this one would be great.
best regards
Jörg