eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Text on point item is not aligned

Hi

I have to put text on point item on series , the interval i have taken of 1 hr, but as text is more despite using align: 'left' property it is not getting aligned.
image for ref
Attachments
dumm.JPG
dumm.JPG (9.28 KiB) Viewed 969 times
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Text on point item is not aligned

Hello,

I was trying to reproduce your problem, but in my case everything is working correctly or I don't understand what the problem is. Could you reproduce the issue in an online editor?

Demo: https://jsfiddle.net/BlackLabel/L7mpg0js/

Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Re: Text on point item is not aligned

Hi
Thanks for reply, even in ur demo response for second entry which is on black point it is not completely on the black background. I know text is more than the point item timings but cant we wrap it somehow so that it can be on point item.
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Text on point item is not aligned

Hi,
for second entry which is on black point it is not completely on the black background. I know text is more than the point item timings
Okay, so now I quite understand
cant we wrap it somehow so that it can be on point item.
So what do you want to achieve? Do you want to truncate the text that goes beyond, manipulate the size or hide the entire name if it does not fit? Can you specify?


Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Re: Text on point item is not aligned

I want somehow it adjust to the given space or ellipses like it will look. I wud be great if it wrap in next line.

Thanks
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Text on point item is not aligned

Hi,

Ok, so you can use dataLabels.formatter() callback function to calculate if the text will fit and if not, it will return it with the appropriate formatting.

Demo: https://jsfiddle.net/BlackLabel/mfrwe30t/
API: https://api.highcharts.com/gantt/plotOp ... .formatter

Let me know if you have any further questions!
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Re: Text on point item is not aligned

HI
I am getting dataLabel and shapeArgs does not exist on type point.
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Text on point item is not aligned

Hello,

Can you reproduce this error in an online demo? Because the demo sent by me works fine for me.

Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
eraka
Posts: 123
Joined: Thu Apr 28, 2022 6:55 am

Re: Text on point item is not aligned

I am unable to create one, what i can see when i do this.chartRef.getSelectedPoints() in the selected points i do get dataLabel field but for the this.point i am seeing just shapeArgs but not dataLabel
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: Text on point item is not aligned

Hi,

Unfortunately, that’s all I can do without looking at your code. As you can see, everything you wanted to achieve works fine in the demo provided earlier. If you need further assistance with this issue, please reproduce it in an online editor with Angular.

Regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/

Return to “Highcharts Gantt”