Chart's PDF and PNG output is not the same as actual chart

Hello,

I am using Aspose.Cells v17.4.0 to generate PDF of charts - "Chart 1" and "Chart 2" in the attached excel file. The PDF output is not same as the actual charts. The same is true for other formats also like PNG, SVG etc.

Chart 1:
Some labels are overlapping with chart area, some are overlapping with each other, there are label lines in output which do not exist in actual chart, and the space between the labels is slightly reduced.

Chart 2:
The label lines are shorter than in actual chart and the distance between the labels and chart area is reduced. Some labels are overlapping with the chart area.

The output should look exactly the same as the actual chart. This is a customer reported issue, so its critical for us. Can you please look into this on priority.

Following code is used to generate the output:

Workbook workbook = new Workbook("test.xlsm");
WorksheetCollection ws = workbook.getWorksheets();
String worksheetName = "Sheet1";
Chart chart = ws.get(worksheetName).getCharts().get("Chart 1");
chart.toPdf("D:\\Chart 1 aspose generated-17.4.0.pdf");

I have attached Excel generated Pdf and Aspose generated Pdf along with a screenshot comparing both.

Can you please analyse this issue.

Thanks,
Neha

Hi,


Thanks for your posting and using Aspose.Cells.

After initial investigation, we were able to observe these issues. I have attached the output pdf charts generated with the latest version: Aspose.Cells for Java v17.4.0 using the following code for a reference.

Please spare us some more time to look into these issues in detail, we will log appropriate tickets soon.

Java
Workbook workbook = new Workbook(dirPath + “test.xlsm”);

workbook.calculateFormula();

WorksheetCollection ws = workbook.getWorksheets();
String worksheetName = “Sheet1”;


Chart chart = ws.get(worksheetName).getCharts().get(“Chart 2”);
chart.calculate();

chart.toPdf(dirPath + “Chart2.pdf”);

Hi,


Thanks for using Aspose.Cells.

We were able to observe the issues both in Pdf and Png. So, we have logged all of them in our database for investigation and for a fix.

These issues have been logged as

  • CELLSJAVA-42261 - Chart 1 image is not correct when it is converted to Pdf
  • CELLSJAVA-42262 - Chart 2 image is not correct when it is converted to Pdf
  • CELLSJAVA-42263 - Chart 1 image is not correct when it is converted to Png
  • CELLSJAVA-42264 - Chart 2 image is not correct when it is converted to Png

Hello,

Is there any update on these issues? They have been reported by our customer in their Production Environment and they are asking us for a fix asap.

Can you please look into these issues on priority.

Thanks,
Neha

Hi,

Thanks for your posting and using Aspose.Cells.

We are afraid there is no update for you at this moment regarding your issues. However, we have logged your comment in our database against all of your issues and requested the product team to provide some fix or ETA for them. Once there is some news for you, we will update you asap by posting in this thread.

Hi,


Thanks for using Aspose.Cells.

We have looked in your issues and we are afraid these issues cannot be fixed. The position of data labels is dynamical and there is no exact position information present inside the excel file. So, we cannot do same as the Microsoft Excel. If you drag the right-bottom corner of chart in MS-Excel and enlarge the size of chart, you will find the position of data labels changes too.

Hello,

As per a separate thread of our issues, you have mentioned that the following issue has been fixed:

  • CELLSJAVA-42264 - Chart 2 image is not correct when it is converted to Png

But this issue is still not fixed in Aspose.Cells v17.8.

PFA the attachments for this issue: attachments.zip (1.9 MB)

Can you please analyse this.

Thanks,
Neha

@Neha_Gautam

Only thing we can ensure is that labels should not be overlapping. Please check the attached Microsoft Excel 2016 image of your chart. You see, label position does change, but they do not overlap with each other.

In your image, we find only the label saying 5% is overlapping while others are good. So, we will fix only this issue. We will log 5% label issue in our database after your feedback.

Screenshot:
sc.png (61.7 KB)