We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Label incorrect on image export from chart


when i convert my chart to image the label is not displaying the data properly. in excel chart it is working properly. bellow is my code. and i have attached my excel file and image file as well.
when i set the pivotTable.setColumnGrand(true), it works fine.

I’m using the last version of aspose cells 8.4.0


final Workbook workbook = new Workbook();
final Worksheet sheet = workbook.getWorksheets().get(0);
final Cells cells = sheet.getCells();
Cell cell = cells.get(“A1”);
cell.setValue(“Types “);
cell = cells.get(“A2”);
cell.setValue(“Type 1”);
cell = cells.get(“A3”);
cell.setValue(“Type 2”);
cell = cells.get(“A4”);
cell.setValue(“Type 3”);
cell = cells.get(“A5”);
cell.setValue(“Type 4”);
cell = cells.get(“A6”);
cell.setValue(“Type 5”);
int sheetIndex = workbook.getWorksheets().add();
final Worksheet sheet2 = workbook.getWorksheets().get(sheetIndex);
final PivotTableCollection pivotTables = sheet2.getPivotTables();
final int index = pivotTables.add(”=Data!A1:A6”, “B3”, “PivotTable1”);
final PivotTable pivotTable = pivotTables.get(index);
pivotTable.addFieldToArea(PivotFieldType.ROW, 0);
pivotTable.addFieldToArea(PivotFieldType.DATA, 0);
sheetIndex = workbook.getWorksheets().add(SheetType.CHART);
final Worksheet sheet3 = workbook.getWorksheets().get(sheetIndex);
final int chartIndex = sheet3.getCharts().add(ChartType.PIE, 0, 5, 28,
final Chart chart = sheet3.getCharts().get(chartIndex);
final ImageOrPrintOptions imageOptions = new ImageOrPrintOptions();
chart.toImage(new FileOutputStream(“c:\2\pivotChartImage.png”),


Thanks for your posting and using Aspose.Cells.

Please download and use the latest version: Aspose.Cells
for Java v8.4.0.7

Please call Chart.refreshPivotData() before taking the image of the chart.

We have tested this issue with the following sample code using the latest version and it generated the correct chart. I have attached the output chart image for your reference.


String filePath = “F:\Shak-Data-RW\Downloads\pivotTable.xls”;

Workbook workbook = new Workbook(filePath);

Worksheet worksheet = workbook.getWorksheets().get(“PivotChart”);

Chart chart = worksheet.getCharts().get(0);



I downloaded Aspose.Cells for Java v8.4.0.7. and everything works fine.
But the legend of the chart, I wanna show “Type 1”, “Type 2”, “Type 3”, “Type 4” and “Type 5”, and not “Count of Types” like in the image, but like the chart in the pivotTable.xls


Thanks for your feedback and using Aspose.Cells.

We were able to observe this issue after running your sample code with the latest version and found that pivot chart image is different than xls pivot chart.

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

This issue has been logged as

  • CELLSJAVA-41273 - Pivot Chart image shows Count of Types instead of Types

I have also attached the screenshot that highlights this issue for a reference.

Hi Shakeel! Any update on this issue?



Thanks for your posting and using Aspose.Cells.

We are afraid, there is no update for you at this moment regarding this issue. However, we have logged your comment in our database against this issue and requested the product team to provide some ETA or fix for this issue. Once, we will have some update for you, we will let you know asap.


Thanks for your posting and using Aspose.Cells.

We are afraid your issue is yet unresolved. However, we have logged your comment in our database against this issue and requested the product team to provide some ETA for this issue. Once there is some news for you, we will let you know asap.

Please try our latest version/fix: Aspose.Cells for .NET v21.6.3 (attached)
Aspose.Cells21.6.3 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.6.3 For .Net4.0.Zip (5.5 MB)
Aspose.Cells21.6.3 For .NetStandard20.Zip (5.5 MB)

Your issue should be fixed in it.
Let us know your feedback.