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

Free Support Forum - aspose.com

Category axis value alignment

Hi Team,

Could you please tell how to align the category axis values to the center of corresponding bars.

Here by i attached the sample excel file for your reference.(I have created this excel file in java using aspose jar)

Thanks & Regards,


Thanks for the template file.

Please try DataLabels.setPosition attribute to accomplish your task. I have tested using the following sample code with your template file and it works fine.
Sample code:
Workbook workbook = new Workbook(String.valueOf(“sample.xlsx”));

// Get chart worksheet
Worksheet sheet = workbook.getWorksheets().get(“Chart”);
Chart chart = sheet.getCharts().get(0);
DataLabels datalabels;

for (int i = 0; i < chart.getNSeries().getCount(); i++) {

datalabels = chart.getNSeries().get(i).getDataLabels();

// Set the position of DataLabels

Let us know if you still have any issue.

Thank you.


Thanks for your response.

One more request is how we could align the category axis tick label to the center of the bar.

I have attached the screenshot for your reference.

Thanks & Regards,


How could you do this in MS Excel? I think this is not possible. If you still think this is possible, kindly do align the tick labels to the center of the bar in MS Excel manually, re-save the file and post us here, we will check how to do it via Aspose.Cells APIs.

Thank you.