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

Free Support Forum - aspose.com

Excel chart to image transformation gives an incorrect chart

Hi,

I am using Aspose cells 8.4.2.
In context of the attached excel sheet, when I transform Chart 2 to image, following issues have been observed:
1. The text ‘Source: ABC Chemial’ gets moved to the center of the box, rather than being on the left.
2. There is a black dot in the center of chart.
3. The arrows are looking way too big/dirty than the source.
4. There is stripping of data ‘XYZmotive and Industrial
Hose/Tubing’ under the title banner.
5. Hyphen - in the chart title transforms to box o in the image.

Can you please address these issues at the earliest?


Thanks,
Jaspreet

Hi Jaspreet,


Thank you for contacting Aspose support.

I have evaluated your presented scenario while using the latest version of Aspose.Cells for Java 8.4.2.2 to render the chart from your provided spreadsheet in EMF format. I am able to observe the following problems that have been logged under the ticket CELLSJAVA-41356 for further investigation.

  1. The text ‘ABCDE consumption of chlorinated ABCDE by major end use - 2014’ has lost the left alignment.
  2. The text ‘Source: ABC Chemical’ has lost the left alignment and moved to center of the image
  3. The arrows look wavy as compared to the source.
  4. Stripping of text ‘XYZmotive and Industrial Hose/Tubing’ for one of the data labels.
  5. Hyphen - in the chart title transforms in the image.
  6. Space between the text ‘metric’ & ‘ton’ seems to be lost for the text ‘Total = 711 thousand metric tons’.

Please provide an image along with your source code snippet from your side so we could compare the results.

Hi,


We are using the API, chart.toImage(…) to transform the chart to PNG.
Attached the problematic chart image.

Also, were you able to reproduce the issue ‘black dot in the center of the chart’?

Thanks,
Jaspreet

Hi Jaspreet,


Thank you for the confirmation.

Yes, I am able to see the small dot at the center of the Pie chart when it is rendered to PNG format. Please note, this issue is not reproducible when resultant image is of EMF type. I have logged this incident under a separate ticket CELLSJAVA-41359 for further investigation. Please allow us some time to properly analyze the scenario, and get back to you with updates in this regard.

Hi Jaspreet,


Please try the latest version of Aspose.Cells for Java 8.4.2.8 (attached) against the tickets logged earlier as CELLSJAVA-41356 & CELLSJAVA-41359, and let us know of your feedback.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,


Though most of the above mentioned items appear to be resolved in Aspose cells v8.5 but the data labels are still being overridden by the header for the attached excel document.

Can you please verify.

Thanks,
Jaspreet

Hi,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue after executing the following code with the latest version: Aspose.Cells for Java 8.5.0 using your source excel file and converting it to pdf. Data labels are being overridden by the header section.

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-41387 - Data labels are being overridden by the header section

I have attached the output pdf and screenshot highlighting this issue for a reference.

Java

String filePath = “F:\Shak-Data-RW\Downloads\header+overlaps+labels+(1).xlsx”;


Workbook workbook = new Workbook(filePath);


PdfSaveOptions opts = new PdfSaveOptions();

opts.setOnePagePerSheet(true);


workbook.save(filePath + “.out.pdf”, opts);

Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells
for Java v8.5.0.2
and let us know your feedback.

Hi,

I tried regressing the above issues with the latest Aspose Cells v8.5.0.2.
Here are my observations:
1. The arrows appear very dark & bold & overlap the data labels in png & pdf outputs for both the sample charts.
2. “Source: Chemical” is overridden by Chart border in png & pdf outputs of Chart 1.
3. The text box “Total = 711 thousand metric tons” dislocates to left in PDF output of Chart 2.

The chart to PDF approach used is same as mentioned in following thread:
Chart to Image/PDF conversion does not export the contained textbox

Can you please verify.

Thanks,
Jaspreet



Hi Jaspreet,

Thanks for your posting and using Aspose.Cells.

We were able to observe the following issues and logged them in our database for investigation. We will look into them and fix these issues. Once these issues are resolved or we have some other update for you, we will let you know asap.

These issues have been logged as

  • CELLSJAVA-41400 - Arrows inside the chart appear very dark and bold and overlap the data labels in PDF output
  • CELLSJAVA-41401 - Arrows inside the chart appear very dark and bold and overlap the data labels in PNG output
  • CELLSJAVA-41402 - “Source: Chemical” is overridden by Chart border in PNG
  • CELLSJAVA-41403 - “Source: Chemical” is overridden by Chart border in PDF

However, we were not able to find the text box dislocates issue
mentioned in point 3. I have attached the output pdf for your reference
generated with the following code.

Java

String filePath = “D:\Downloads\bad_looking_chart±+Copy.xlsx”;


Workbook workbook = new Workbook(filePath);


PdfSaveOptions opts = new PdfSaveOptions();

opts.setOnePagePerSheet(true);


workbook.save(filePath + “.out.pdf”, opts);

Hi,

Thanks for using Aspose.Cells for Java.

Please download and try this fix: Aspose.Cells for Java v8.5.0.4.

Please try the new fix for CELLSJAVA-41402 and CELLSJAVA-41403.

For CELLSJAVA-41400 and CELLSJAVA-41401

1. Arrow is dark. It is not a problem. If you save pdf using Excel, the arrow is dark and bold too.

2. Arrow overlaps the labels. We can’t improve the issue. It’s too complex. You may make the leader lines shown (Right click labels > Format datalabels > Label Options > Show leader lines) to replace the arrows.

Hi,


In context of the point 3 in the above thread as per which " The text box “Total = 711 thousand metric tons” dislocates to left in PDF output of Chart 2." this is still reproducible with the latest version 8.5.0.4 of Aspose cells and here’s the code snippet to reproduce the issue at your end.

Here we are copying the chart ‘Chart 2’ to new worksheet & take PDF of the workbook after hiding the rest of the sheets.
public static void main(String[] args) throws Exception {
License asposeCellsLicense = new License();
InputStream licenseStreamForCells = new FileInputStream(“C:\temp\Aspose.Total.Java.lic”);
try {
asposeCellsLicense.setLicense(licenseStreamForCells);
} finally {
licenseStreamForCells.close();
}
Workbook workbook = new Workbook(“bad_looking_chart (8).xlsx”);

WorksheetCollection ws = workbook.getWorksheets();
ChartShape cshape = ws.get(0).getCharts().get(“Chart 2”).getChartObject();
Chart chart = ws.get(0).getCharts().get(“Chart 2”);
int sheetIndex = ws.add();
com.aspose.cells.Worksheet worksheet = ws.get(sheetIndex);
chart.calculate();
double chartWidthInInches = chart.getChartObject().getWidthInch();
double chartHeightInInches = chart.getChartObject().getHeightInch();
boolean defaultApproach = true;
worksheet.getCells().setColumnWidthInch(0, chartWidthInInches);
worksheet.getCells().setRowHeightInch(0, chartHeightInInches);

//Setting the name of the newly added worksheet
String transientSheetName = “TransientWorksheet”;
worksheet.setName(transientSheetName);
//Copy the Chart to Second Worksheet
worksheet.getShapes().addCopy(cshape, 0, 0, 0, 0);
//Get the new chart and set its height and width accordingly
com.aspose.cells.Chart chart1 = worksheet.getCharts().get(0);
chart1.getChartObject().setHeightInch(chartHeightInInches);
chart1.getChartObject().setWidthInch(chartWidthInInches);
//Make remaining worksheets invisible so that they are not part of the output pdf
for (int i = 0; i < ws.getCount(); i++) {
String sheetName = ws.get(i).getName();
if(!transientSheetName.equalsIgnoreCase(sheetName)){
ws.get(i).setVisible(false);
}
}
//PdfSaveOptions pdfSaveOptions = getPdfSaveOptions();
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();

worksheet.getPageSetup().setTopMargin(0);
worksheet.getPageSetup().setBottomMargin(0);
worksheet.getPageSetup().setRightMargin(0);
worksheet.getPageSetup().setLeftMargin(0);
//Setting Print area to first cell only as the chart is contained in the first cell (A1:A1)
if (defaultApproach) {
worksheet.getPageSetup().setPrintArea(“A1:A1”);
}
// Save the workbook
//File outputPdfFile = OfficeResourceUtility.createTemporaryFile(".pdf");
workbook.save(“c:\temp\out.pdf”, pdfSaveOptions);
workbook.save(“c:\temp\outExcel.xlsx”, SaveFormat.XLSX);
}

Attached the original excel doc & problematic output PDF.
Can you please verify & revert back as soon as possible.

Thanks,
Jaspreet

Hi Jaspreet,


Thank you for writing back.

We have reevaluated the presented scenario against the latest version of Aspose.Cells for Java 8.5.0.4, and are able to notice the problem, that is; the Text Box txtBoxSourceLine seems to have displaced towards left in the resultant PDF. We have logged this incident in our bug tracking system under the ticket CELLSJAVA-41406 for further investigation. Please allow us some time to look further into this matter. As soon as we receive more updates, we will post here for your kind reference.

The issues you have found earlier (filed as CELLSJAVA-41406;CELLSJAVA-41403;CELLSJAVA-41402;CELLSJAVA-41387) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,

I tried with latest v8.5.1
Though the above message says “CELLSJAVA-41387” has been fixed but the issue still persists in the PDF output of Chart 1.
Data labels are still being overridden by the chart header.

Can you please verify.

Thanks
Jaspreet


Hi Jaspreet,


You are right. Although the rendering has improved with recent release of Aspose.Cells for Java 8.5.1 however, the characters C & E of data label Central Europe are still hidden behind the header strip when rendered to PDF format. We have re-opened the ticket CELLSJAVA-41387 and have requested the product team to re-evaluate this scenario for further improvements.

Hi,

Thanks for using Aspose.Cells for Java.

We have improved output pdf for your issue logged as CELLSJAVA-41387.

Please download and try this fix: Aspose.Cells for Java v8.5.1.2 and let us know your feedback.

Hi,


The output PDF seems to have improved in context of issue CELLSJAVA-41387.

In addition, I have an observation w.r.t. arrows in chart output images.
The best image output of arrows was in version 8.5 of Aspose cells
Can’t we have the same arrows output in the latest Aspose.Cells version.
For reference, I have attached the image outputs over Aspose versions for comparison.

Thanks,
Jaspreet Kaur

Hi Jaspreet,


Thank you for the confirmation on CELLSJAVA-41387.

Regarding your recent comments about the arrow shape to point data labels, I am afraid, I am not able to see any change in the arrow shape or size from your attached snapshots. The only change in all the attached pictures is the position of the data labels. I would request you to please open all the images side by side and compare them. In case you find any difference, please provide the snapshot highlighting the area for further investigation.