Free Support Forum - aspose.com

How do i set the chart bgcolor?

Hi,


How can i set the chart bgcolor? I have create a chart using aspose api. By default grey bgcolor is set to that chart. I want to set the bgcolor as white. Refer the attached ods file, Chart 1 in that file is created using aspose. Chart 2 is created using openoffice.

Regards,
Santhosh

Hi Santhosh,


Please use the following source code to change the colour for Chart Plot Area.

JAVA Source Code
Workbook book = new Workbook();
book.open(“C:\temp\chart.ods”);
Chart chart = book.getWorksheets().getSheet(0).getCharts().getChart(0);
chart.getPlotArea().getArea().setForegroundColor(Color.WHITE);
book.save(“C:\temp\output.ods”);