How to set different colors for sectors of 3D Pie Chart?

Hi Team,

In the attached excel, I have a 3D Pie chart with 4 sectors.

I want to set different colors for these 4 sectors.

Could you please share some sample code in JAVA for this requirement.

Thanks in advance,
Sanjeev (9.1 KB)


Thanks for the template file.

See the following sample code on how to apply different color to different Pie chart slices and its border color for your reference. I used your template file and modify different slices (series points) color for the existing chart in the worksheet:
Sample code:

	    Workbook book = new Workbook("f:\\files\\3DPieChartSlicesColoring.xlsx");
		ChartCollection charts = book.getWorksheets().get(0).getCharts();
		Chart chart = charts.get(0);
		Series series = chart.getNSeries().get(0);
	        //Define colors, I will get the colors from default color palette.
	        Color[] colors = book.getColors();
		for (int j = 0; j <series.getPoints().getCount(); j++)
	               ChartPoint p = series.getPoints().get(j);

Hope, this helps a bit.