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

Free Support Forum - aspose.com

Spacing issue between the legend and the axis labels of the chart

Hi,


We are facing following issue with aspose-cells-8.5.2.4.

In PDF output of the chart, the space between the x-axis labels and legends is not honoured. For your reference I have also attached the PDF generated directly from MS Excel.

Following is the code used to generate the output:

WorksheetCollection ws = workbook.getWorksheets();
Chart chart = ws.get(“mash flow”).getCharts().get(“Chart 1”);
ChartShape cshape = chart.getChartObject();

int sheetIndex = ws.add();

com.aspose.cells.Worksheet worksheet = ws.get(sheetIndex);

chart.calculate();

double chartWidthInInches = chart.getChartObject().getWidthInch();
double chartHeightInInches = chart.getChartObject().getHeightInch();

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 target 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 = new PdfSaveOptions();
pdfSaveOptions.setOnePagePerSheet(true);

worksheet.getPageSetup().setTopMargin(0);
worksheet.getPageSetup().setBottomMargin(0);
worksheet.getPageSetup().setRightMargin(0);
worksheet.getPageSetup().setLeftMargin(0);

worksheet.getPageSetup().setPrintArea(“A1:A1”);

workbook.save(“c:/temp/Aspose Generated-Chart 1.pdf”, pdfSaveOptions);
Thanks,
Neeraj


Hi Neeraj,


Thank you for sharing the sample.

We have evaluated the presented scenario while using the latest version of Aspose.Cells for Java 8.6.0.6, and we are able to replicate the said issue on our side. In order to further investigate the matter, a ticket with Id CELLSJAVA-41533 has been logged in our database. Our product team will further look into the details of this problem and we will keep you updated on the status of correction.

Hi,

Thanks for using Aspose.Cells for Java.

Please try the new fix and generate chart pdf using new method chart.toPdf().

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

Hello,



I tried your fix. I used aspose.cells v8.6.1.4 to generate PDF using chart.toPdf() method but the spacing issue is still not resolved. I have attached the pdf taken using aspose.cells v8.6.1.4 and using excel.



Thanks,

Neeraj

Hi Neeraj,


Thank you for your feedback. We have checked the case against the latest version of Aspose.Cells for Java 8.6.1.6, and we believe there is improvement regarding the spacing between the horizontal axis labels and legend entries with latest build, however, there is still some difference if we compare the PDF generated with Aspose.Cells against the Excel’s generated file. Based on these observations, we have logged your concerns to the existing ticket CELLSJAVA-41533 by requesting the concerned member of the product team to reanalyze the case to see if there is room for improvement. We will keep you posted with updates in this regard.

Hi,


We have analyzed your issue “CELLSJAVA-41533”. We will improve the rendering (regarding spacing) a bit in our next fix. But, I am afraid, we may not do exactly the same as per MS Excel.

Once the fix is available, we will let you know here.

Thank you.

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


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

Hi,


We have tested this issue with Aspose Cells 8.6.2. But unfortunately it is not yet fixed. The output is same what we got using version 8.6.1.6 last time.

Thanks,
Neeraj

Hi,


We will provide you our next revision for v8.6.2 in the next week (hopefully) that would address your issue a bit.

Keep in touch.

Thank you.


Hi,


Could you please try our latest version/fix: Aspose.Cells for Java v8.6.2 if it fixes your issue, you may download it here:
http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/entry670755.aspx

Let us know your feedback.

Thank you.

Hi,


I have tested this issue using chart.toPdf(…) method of Aspose Cells v8.6.2. But unfortunately it is not yet fixed. The output is same what we got using version 8.6.1.6 last time. I have attached the pdf taken using Aspose Cells v8.6.2.

Thanks,
Neeraj

Hi,


As communicated the fix for this should be available 8.6.2.1.
I have tested this with the recently released Aspose Cells 8.6.2.1. Unfortunately the issue does not get fixed in this release as well.

Can you please look into this on priority and let me know when could we get the fix for this?

Thanks,
Neeraj

Hi,


Yes, with v8.6.2.1, it is better but not the best though, see the attached output chart in the PDF, I generated the PDF file using the following sample code:
e.g
Sample code:

Workbook workbook = new Workbook(“LegendSpacingIssue.xlsm”);
WorksheetCollection ws = workbook.getWorksheets();
Chart chart = workbook.getWorksheets().get(“mash flow”).getCharts().get(“Chart 1”);
chart.toPdf(“out1Chart1.pdf”);


I think we might provide you a revision (another fix) in coming weeks. I have also asked the relevant developer from product team (by logging comments against your issue in the database) in which fix, your issue would be sorted out completely. Also, we will notify you explicitly in this thread when it is available.

Once we have any update on it, we will let you know here.

We are sorry for any inconvenience caused!

Thank you.
Thanks for your response.

Sorry to say - I have checked all the output ranging from 8.5.4.2, to 8.6.1, 8.6.2 and 8.6.2.1.
But I could not see even any improvements with regards to the spacing between legends and labels for which the issue have been logged. Output seems to be more or less the same for that.

Can you please look into this on priority as it is production issue being faced by one of our customers.

Thanks,
Neeraj

Hi,


We understand your concerns. Please spare us little time, hopefully in coming week, we will try to provide the fix or a workaround to figure out your issue completely.

Thank you.


Hi,


I have discussed the matter in details with the relevant developer of the product team. Well, we have already improved the Chart to PDF/image rendering in latest fix and fixed the issue to make the axis labels not overlapped with the legend items. But we are afraid, we cannot make exactly the same as per Ms Excel. We tried to figure out spacing (b/w axis labels and legend items) issue but I am afraid, we could not find a better solution for now, so the spaces b/w axis labels and legend items might not be exactly the same.

Anyways, considering your concerns for your issue “CELLSJAVA-41533”, we have reopened your issue again and our relevant developer will still look into it further, but we cannot promise any definite fix or eta at the moment.

Once we have any update on it, we will let you know here.

We are sorry for any inconvenience caused!

Hi,


Thanks for your response but just to let you know that this issue is very critical for us as it is being faced by one of our customers in the production environment.

On further analysis - to me this seem to be font specific issue. Because, the PDF generated using Aspose shows “Arial MT” whereas the one generated from within Excel shows “Arial” in the “Document Properties” of the PDF. Moreover, the fonts encoding is also different between the two. Attached are the screenshot of document properties of both the PDF for your reference.

I would appreciate if you look into this on priority.

Thanks,
Neeraj

Hi,


Well, the document properties for both converted PDF files (via Aspose.Cells and MS Excel) are more or less the same, you may see the actual font name is ArailMT and type is TrueType in your screen shots for both conversions.

Anyways, I have logged it against your issue in our database. And as I said before the concerned developer will look into your issue further and once we have any update on it, we will let you know here.

Thank you.

Hi,


Thanks for your response.

That was my findings which I shared with you which may or may not be of your help in resolving the given problem. However, I still have following observations with regards to the difference in fonts:
1) Although, actual font is same but the encoding being shown is different.
2) If you open both of the PDF documents in “Adobe Acrobat Professional”, select the text and look at the text properties, you will observe in the font properties the font being shown is “Arial” in one PDF whereas “ArialMT” in another.

Following additional issue is observed in the output PDF:
Alignment of legends with axis labels is not proper. Attached is the screenshot for your reference. Please look into this as well.

Although your team is putting in best of your efforts to resolve this issue, I would like this to be escalated and brought to the notice of appropriate higher authority as well because this is a critical production issue which has huge financial obligation on us.

Thanks,
Neeraj


Hi,


Thanks for providing further details.

Regarding alignment issue, you are right as I noticed that the legend items are not aligned properly with respect to axis labels. I have also logged it with your other findings into our database and our developer will look into your issue and investigate it thoroughly.

Moreover, we do understand your concerns and inconvenience you have been facing. We have extended the priority of your issue. For your information, the problems/ issues our users post in normal forums (other than Priority Support or Enterprise support clients) are resolved on first come first serve basis as we believe this is the fairest policy to all the customers. Nevertheless, as per our product team schedule, they will try to fix these issues (especially alignment issue) if they can.

Once we have any update on it, we will let you know here.

Thank you.