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

Free Support Forum - aspose.com

Chart Legend can’t be aligned center- JAVA

Hello,

I have created a chart using aspose.cell in java , and then converted it to an image. The legend aligns left (not center of chart) especially when I have few records on it. It seems to be better aligned when I have more than 3-4 records. I have tried the setting: chart.getLegend().setX = 500, 800 etc , however, it does not change anything

could you share me some idea so that I can move the legend to center of chart?

Thanks,

Best regards

@sZiu,

Could you please provoide your sample code and the Excel files. We will check it and get back to you soon.

@sZiu,

We are not sure about your source data in template Excel file. We appreciate and request you to provide a standalone Java program (runnable) with sample files (please zip template Excel file and other files prior attaching) and post us to reproduce the issue on our end. We will check your issue soon.

ex.zip (1.3 MB)

@sZiu,

I did check your sample code segment which I cannot compile, there are some objects/variables for which I am not sure about its data/values. I am not sure about your list data which you are inserting into the worksheet cells. We request you to kindly create a separate standalone console Java program (source code without compilation errors) to show the chart’s rendering issue regarding legend alignment. Also, by checking your PDF file I found it is created by Aspose.Words. By the way, when you save to Excel file at the end, chart is ok or not?