Free Support Forum - aspose.com

Data label formatting for charts

Hi,


Recently I discovered this issue. This was working fine when I initially developed my code. But seems like after I upgraded my aspose to the version I am using now(7.2.2.1); this issue started happening. I even tested this with the latest vesion(7.3.2) and the issue still exists.

I am trying to set the number format of the data label. But this is not getting set. Here is the code piece. Attached the input and output files also. Please take a look.


Workbook workbook = new Workbook(“C:/Pravat/Eclipse_WS/AW/export/trunk/test/resource/Population-In.xlsx”);
ChartCollection charts = workbook.getWorksheets().get(0).getCharts();
Chart chart = charts.get(charts.add(ChartType.PIE, 0, 0, 15, 8));
Series series = chart.getNSeries().get(chart.getNSeries().add("=Sheet1!$K5:N5", false));
series.setType(ChartType.COLUMN);
series.setXValues("=Sheet1!$K4:N4");

chart.setPlotEmptyCellsType(PlotEmptyCellsType.NOT_PLOTTED);
DataLabels dataLabels = series.getDataLabels();
dataLabels.setShowValue(true);
dataLabels.setNumberFormat("#,##0.0");
workbook.save(“C:/Pravat/Eclipse_WS/AW/export/trunk/test/resource/Population-Out.xlsx”);


Though this works for line and pie charts; but not for any other.

Hi,

Thanks for your posting and using Aspose.Cells for Java.

We were able to replicate your mentioned issue with the following given code using your source file with the latest version:
Aspose.Cells
for Java v7.3.2.2


I have attached the output chart generated by this code and the screenshot highlighting this issue for your reference.

We have logged this issue in our database. We will look into it and fix the issue. Once the issue is fixed or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSJAVA-40342.

Java


String filePath = “F:\Shak-Data-RW\Downloads\Input.xlsx”;


Workbook workbook = new Workbook(filePath);


ChartCollection charts = workbook.getWorksheets().get(0).getCharts();

Chart chart = charts.get(charts.add(ChartType.PYRAMID, 0, 0, 15, 8));


Series series = chart.getNSeries().get(chart.getNSeries().add("=Sheet1!$K5:N5", false));

series.setType(ChartType.COLUMN);


series.setXValues("=Sheet1!$K4:N4");


chart.setPlotEmptyCellsType(PlotEmptyCellsType.NOT_PLOTTED);

DataLabels dataLabels = series.getDataLabels();

dataLabels.setShowValue(true);

dataLabels.setNumberFormat("#,##0.0");


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

Screenshot:

Hi,


Please try the attached latest fix/version: Aspose.Cells for Java

Your issue should be fixed in it.

Let us know if you still find any issue.

Thank you.

The issues you have found earlier (filed as CELLSJAVA-40342) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.