Page 1 of 1

How to add two labels in Y axis

Posted: Wed Jan 26, 2022 12:09 pm
by lalana
Any idea about adding two labels into y axis of line chart as show in the image,
Eg: - (above 0 'profit' and below 0 'Loss')
https://ibb.co/p4Brh6y
Image

Re: How to add two labels in Y axis

Posted: Wed Jan 26, 2022 12:24 pm
by mateusz.b
Hi lalana,

Welcome to our forum and thanks for contacting us with your question!

You should use yAxis.labels.formatter.
Demo: https://jsfiddle.net/BlackLabel/2tjc8wzh/

Let me know if that was what you were looking for!
Regards!

Re: How to add two labels in Y axis

Posted: Thu Jan 27, 2022 2:51 am
by lalana
Thanks this works!! . I was wondering if it was able to format the title instead of Label.

Re: How to add two labels in Y axis

Posted: Thu Jan 27, 2022 10:04 am
by mateusz.b
It would be quite hard to do something like that with title. Of course you can change title content with title.text property, but positioning and keeping it responsive could be challenging. Label formatter is much better choice. Alternatively, you could use SVGRenderer tool , which allows you to draw shapes and text on your chart, to draw those labels.

Regards!

Re: How to add two labels in Y axis

Posted: Thu Jan 27, 2022 4:33 pm
by lalana
Thanks for the update Mateusz

Re: How to add two labels in Y axis

Posted: Thu Jan 27, 2022 5:28 pm
by mateusz.b
You're welcome! In case of any further questions feel free to contact me anytime!

Regards!