alisson.silva
Posts: 3
Joined: Fri Jun 18, 2021 7:08 am

Sort Y Axis Multiple Series - Data Labels position

Hello!

I got this example of how to sort Y Axis with multiple series: https://jsfiddle.net/fws84pyr/

It works fine, however the data labels are kept in their original position instead of moving along with their underlying data points.

Is there a way to move the data label together?

Thanks,
Alisson
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Sort Y Axis Multiple Series - Data Labels position

Hello alisson.silva!

We appreciate you reaching out to us!

You've changed the way how the redraw event works on the chart. You also need to change the position of dataLabel when you translate the chart. You can simply set the coordinates of the point's dataLabel by yourself. You can do it in your function before pushing the points to the chart, or after that using the update method on each point.

API references:
https://api.highcharts.com/class-refere ... int#update
https://api.highcharts.com/highcharts/s ... dataLabels
https://api.highcharts.com/highcharts/s ... taLabels.x
https://api.highcharts.com/highcharts/s ... taLabels.y

Best regards!
Dominik Chudy
Highcharts Developer
alisson.silva
Posts: 3
Joined: Fri Jun 18, 2021 7:08 am

Re: Sort Y Axis Multiple Series - Data Labels position

Hi Dominik,

I appreciate your answer.

To be honest, the code sample I shared was not created by me, the implementation was provided in a GitHub issue to help me:

https://github.com/highcharts/highcharts/issues/15632

However I realized it didn't account for data labels position.

I'll go through the docs you shared and see if I can come up with a fix, and let you know.

Thanks,
Alisson
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Sort Y Axis Multiple Series - Data Labels position

Hi again!

Oh, all right. So as you said, go through the docs and if you have any further questions please let me know. :)

Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Usage”