We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Set the color of a single bar in a chart


I have a bar chart in a slide consisting of a single series and a number of categories. I would like to set the color of an individual category or bar.
I tried the following code without success:

chart.ChartData.Series[0].DataPoints[0].Format.Fill.SolidFillColor.Color = color;

But this doesn’t affect the color of the bar representing DataPoints[0].

I would really appreciate your help on this issue.

Best regards

Hi Nasser,

I have observed your requirements and code statement shared. Actually, you are not using the complete code. You first need to set the Fill Type and then the color like below.

chart.ChartData.Series[0].DataPoints[0].Format.Fill.SolidFillColor.Color = Color.Black ;

I hope this will work. Please share, if I may help you further in this regard.

Many Thanks,

Hi Mudassir,

thank you for your reply, it works out now!

Best regards