Rowan,
In that case, I agree with @bastss - the best way to achieve this is to return
dataLabels from
formatter() function with
useHTML: true property. I recommend it as a Highcharts Developer and I am not able to try and test your approach because I do not have a whole of your code I can work on.
Now I am going to explain you, why I believe that our approach is the best:
1) It is easy to implement and we have already prepared a simplified demos for you in at least a few examples above including other topics. You can find even more examples on this forum, Stack Overflow forum or on the different websites because it is a really popular issue.
2) dataLabels have direct access to the point's information and you can display in dataLabels whatever you want - we have shown you a few examples above and in other topics.
3) dataLabels have direct access to the point's coordinates and you don't have to worry about their positions. Additionally, dataLabels correct their positions on every
window redraw and are
fully responsive. Also, you can simply move them relatively to the point using
dataLabels.x and
dataLabels.y properties.
I could find more arguments but I believe it is enough to convince you at least to try to implement our approach.
However, if you really want to stick at your approach and you want to find the point's (x,y) coordinates... @bastss has already answered your question and gave you this jsFiddle:
http://jsfiddle.net/Bastss/1e9y7van/
I have prepared another one for you:
https://jsfiddle.net/BlackLabel/keq36wy7/
You are looking for
point.plotX and
point.plotY properties. Also, you might want to read about
chart.plotLeft and
chart.plotTop properties in main
chart object.
One more time I will redirect you to API - you will find really useful information in there:
https://api.highcharts.com/highcharts/p ... dataLabels
https://api.highcharts.com/highcharts/p ... .formatter
https://api.highcharts.com/highcharts/p ... ls.useHTML
https://api.highcharts.com/highcharts/p ... int.events
If you still have problems with your project, I can give you one more time contact details to Black Label company that specializes in custom Highcharts projects:
http://www.blacklabel.pl
[email protected]
Kind regards!