How to position AmCharts 5 X-Axis label to the right?

207 Views Asked by At

I've added a x-axis label to my bar chart, but i would like it to be next to the x-axis, not at the bottom.

This is what i have now:

AM5 how it is now

But i would like it to be like this: What i want AM5

What i've tried:

xAxis.children.push(
      am5.Label.new(root, {
          text: "ETD",
          textAlign: 'right',
          x: am5.p100,
          fontSize: 11,
      })
);

I've also tried something along the lines of this: AM4 Titles on top of vertical axis using paddingRight in AM5. Sadly without result.

I've also tried some options from this AM5 list, but also found no solution.

1

There are 1 best solutions below

0
On BEST ANSWER

Add this in place of you old xAxis.children.push.

xAxis.children.push(
      am5.Label.new(root, {
          text: "ETD",
          textAlign: 'right',
          x: am5.percent(105),
          y: am5.percent(-30),
          fontSize: 11,
      })
);

You can adjust the Text by change this x and y percent.