Free Support Forum - aspose.com

Line Chart data label customization

Hi,


Is there a way to customize data labels on line charts?

I would like the following:
1) put values other than Y coordinate
2) an ability to have no label for some data point

Please see attached screenshot for more details.

Hi,

Thanks for your interest in Aspose.Cells

Please also provide the xls/xlsx file having the same chart as shown in the image. We will look into it and provide you code example

Excel file is attached.


Thanks!

Hi,

Please see the code below. I have changed your line datalabel value -33% to -93% using the following code.

Please see the output xls and screenshot.

Java:


String path = “F:\Shak-Data-RW\Downloads\LineChartDataLabels.xls”;


Workbook workbook = new Workbook();

workbook.open(path);


Chart chart = workbook.getWorksheets().getSheet(0).getCharts().getChart(0);

DataLabels point4 = chart.getNSeries().get(0).getChartPoints().getChartPoint(3).getDataLabels();

point4.setText("-93%");


workbook.save(path + “.out.xls”);

Screenshot:

It works unless you specify Excel 2007 as below:


workbook.save(path + “.out.xlsx”, FileFormatType.EXCEL2007);

Can you tell me if there is a work around?

Thanks!

Hi,


Well, it works fine with the latest version v7.0.1:
http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/entry329168.aspx

Since the release of version v7.0.0: http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/entry325010.aspx
we have ported Java version from .NET, so now it matches with the .NET version regarding features and performance. We have to change the API model to match with .NET version. So, you might need to change your existing code segments accordingly.

Sample code:
Workbook workbook = new Workbook(“LineChartDataLabels.xls”);
Chart chart = workbook.getWorksheets().get(0).getCharts().get(0);
DataLabels point4 = chart.getNSeries().get(0).getPoints().get(3).getDataLabels();
point4.setText("-93%");

workbook.save(“LineChartDataLabels_out.xlsx”, FileFormatType.XLSX);

I have also attached the output file here.


Thank you.


We are using aspose cells 2.4.0_20100823. Do you have any recommendations on how I can troubleshoot the problem with saving workbook for Excel 2007?


Thanks!

Hi,


I am afraid, I cannot help you much as you are using older version i.e. 2.4.x. It might be an issue or limitation with the older version you are using. We recommend you to try our latest version (e.g v7.0.1) as there would be no alternative to fix the issue.

Thank you.
cells version 7 API is different and is not backward compatible with version 2.

I tested with the latest version (before 7) of cells: 2.5.4 and the line:

workbook.save("LineChartDataLabels_out.xlsx", FileFormatType.XLSX);

still does not save the data labels.

Any chance someone can look into this problem?

Thanks!

Hi,


I am extremely sorry but we cannot enhance or fix issues in older versions. Yes, our latest version v7.0.x is not backward compatible and you have to update your codes accordingly, but the latest versions are more enhanced related to Excel features. It might take some time to update your code to be upgraded to latest versions, but in the long run, it will give you more benefits. For example, if you find any issue, we can only fix issues based on the latest version. So, we still recommend you should find time to get familiar with latest APIs and upgrade to latest version, you may continuously update your codes in parallel and test the latest versions. When the task is done, you may replace the older versions with latest version. In the mean time, you may use the older version for your requirement.

Now for your requirement, I am going to attach the last fix in v2.5.4, you may give it a try if it fixes your issue. If your issue is not fixed, I am afraid, there is no other way but to upgrade to latest version.

Thanks for your understanding!

Are you saying that the updated version fixes the issue with data labels in XLSX format?

Hi,

Yes using latest v7.0.1.x, I got no issue with data labels in XLSX format. You may check the attachment in one of my previous post in this thread:
https://forum.aspose.com/t/124882

Thank you.