Free Support Forum - aspose.com

Legend Keys in Charts in Aspose Cells for Java

Hi, I’m having a hard time trying not to show legend keys in my excel charts. I’ve tried


oChart.getChartDataTable().setShowLegendKeys(true);

but it does not seem to work.

Also height and the width are not being respected. The elements seem to be overlapped.

I’m attaching a small demo I prepared. I’m working with Aspose 2.5.4 and Ms Excel 2010.

Thanks,

Jorge

Hi,

Please use Chart.setLegendShown() method. Please see the code below and the source and output xlsx files.

Java


String path = “F:\Shak-Data-RW\Downloads\MyDemo.xlsx”;


Workbook workbook = new Workbook(path);


Chart chart = workbook.getWorksheets().get(0).getCharts().get(0);


chart.setLegendShown(true);


workbook.save(path + “.out.xlsx”);