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

Free Support Forum - aspose.com

How to change Color for Negative Value in Excel Chart

Hello Support Team,

I have a Chart in Excel like the Following.

http://www.aspose.com/demos/aspose.chart/codechart.aspx?galleryitemid=3

I have only one series which contains Positive and Negative Values.
I want to show Green Color for Positive Values and Red Color for Negative Values.

When I try to change the color , the whole Chart affected. I couldn’t change only for Negative and Positive Values.

Kindly let me know the code to change the one color(Green) for Postive Values and another color(Red Color) for Negative Values.

Hi,

Please try the following codes:

chart.NSeries[0].Area.InvertIfNegative = true;
chart.NSeries[0].Area.ForegroundColor = System.Drawing.Color.Blue;
chart.NSeries[0].Area.BackgroundColor = System.Drawing.Color.Red;