Change the Position of Axis label Title


Need help in changing the Position of the Axis label Titles with Aspose cells java api.
X-axis one to the end and Y-axis one to the top with alignment same as axis labels.
Attaching the sample excel for (9.6 KB)

Thanks in advance

Hi @SrideviG
You can use code:

Chart chart0 = book.Worksheets[0].Charts[0];
chart0.ValueAxis.Title.X = 100;
chart0.ValueAxis.Title.Y = 100;
chart0.CategoryAxis.Title.X = 200;
chart0.CategoryAxis.Title.Y = 200;

To adjust the label position.
But how to align with the other labels, we still need some time to investigate this.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-52912

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi @SrideviG
Please try the following code to adjust the CategoryAxis Title:

        book = new Workbook(path + "ChartAxisTitle-01.xlsx");
        Chart chart0 = book.Worksheets[0].Charts[0];
        chart0.CategoryAxis.Title.Y = (int)(chart0.CategoryAxis.TickLabels.TickLabelItems[0].Y * 4000);
        //chart0.ValueAxis.Title.X = (int)(chart0.ValueAxis.TickLabels.TickLabelItems[0].X * 4000);
        chart0.ToImage(path + "1.png"); 

I have done the test, the CategoryAxis Title is supported now, and ValueAxis Title will be supported later. Please try the solution and tell us your feed back.

Hi @SrideviG
Please use Aspose.Cells for java 23.3:

and try the following code:

	Workbook book = new Workbook("TestFiles/ChartAxisTitle-01.xlsx");
    Chart chart0 = book.getWorksheets().get(0).getCharts().get(0);
    for (int ii = 0; ii < 8; ii++)
        chart0.getCategoryAxis().getTitle().setX((int)(chart0.getCategoryAxis().getTickLabels().getTickLabelItems()[ii].getX() * 4000)); 
        chart0.getCategoryAxis().getTitle().setY((int)(chart0.getCategoryAxis().getTickLabels().getTickLabelItems()[ii].getY() * 4000));

        chart0.getValueAxis().getTitle().setX((int)(chart0.getValueAxis().getTickLabels().getTickLabelItems()[ii].getX() * 4000));
        chart0.getValueAxis().getTitle().setY((int)(chart0.getValueAxis().getTickLabels().getTickLabelItems()[ii].getY() * 4000));

        chart0.toImage("ResultFiles/CELLSNET52912_" + ii + ".png");

The above code is to show how to get ticklabel position, to adjust the position of the Axis label to achieve alignment. You can modify it to suit your needs.