Free Support Forum - aspose.com

How to chnage the chart area background color?

How to chnage the chart area background color? For example, the color behind the bar-chart.

Thanks

Charles

Hi,

Thanks for considering Aspose.

Please try the following code:

i). ChartArea chartarea = chart.ChartArea;
chartarea.Area.ForegroundColor = Color.Red;

ii). ChartArea chartarea = chart.ChartArea;
chartarea.Area.Formatting = FormattingType.Custom;
chartarea.Area.FillFormat.Texture = TextureType.BlueTissuePaper;

Thank you.

I did not say the question clearly.

Please check the attachment:

I want to change the color of gray area to white or other color.

Thanks

Charles

Hi,

Thanks for considering Aspose.

Well, my code will change the background color of an area of a chart. But I checked in your template file, this is not an original chart but actually an embeded object in the worksheet. Only the source chart can be manipulated and you may change its background color.

Thank you.

And in the original chart, you may change the color of the gray area (It is called plot area) using the code like:

chart.PlotArea.Area.ForegroundColor = Color.Green;

Thank you.