WillOfTheRoys
Posts: 2
Joined: Mon Apr 12, 2021 8:31 am

Highstock - formatted tooltips, with multiple y-axis

Hello,

As the subject suggests, I have a chart with multiple y-axis. When I use the tooltip formatter and accessing `this.points` it only provides one axis.

This is my formatter:

Code: Select all

            formatter: function () {
              let s = '<b>' + Highcharts.dateFormat('%A, %e %b, %Y %H:%M', this.x) + '</b>'

              this.points.forEach(point => {
                var series = `<strong>${point.series.name}</strong><br/>${series} ${point.y.toFixed(2)}`
              })

              return s
            },
But my chart has 2 series in the first y-axis and 1 series in a second y-axis.

I notice the instance is passed to the formatter and I could dig through instance.chart.series[x].points but it feels long and inefficient way round, I've scoured the docs and stackoverflow and haven't seen this come up before.

Thanks in advance for any help

Will
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Highstock - formatted tooltips, with multiple y-axis

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

Try to edit points of specific series, this is probably the best way to get to them and using it in formatter.
See how the points are stored in the tooltip object as an array of points for each series.

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

Let me know if that was what you were looking for.
Best regards.
Sebastian Hajdus
Highcharts Developer
WillOfTheRoys
Posts: 2
Joined: Mon Apr 12, 2021 8:31 am

Re: Highstock - formatted tooltips, with multiple y-axis

Thanks for the reply, but this doesn't seem to match my issue.

I have 2 yAxes and using this.points in my formatter only receives points for the first yAxis.
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Highstock - formatted tooltips, with multiple y-axis

Hi,
Try to reproduce a simplified version of your case, that will help us better understand your problem.

Best regards.
Sebastian Hajdus
Highcharts Developer

Return to “Highcharts Stock”