简体   繁体   中英

Highcharts Heatmap yAxis with 2 categories. How to show both of them in the tooltip?

I have a HighCharts HeatMap question.

How can I show two yAxis categories in the tooltip?

JSFiddle with my original code

What I'd like to do is something like the following (lines 66 to 71 in jsfiddle):

NB: [linkedTo: 0]

tooltip: {
                    formatter: function () {
                        return '<b>' + this.series.yAxis.categories[this.point.y] + ' yearly average:  ' + this.series.yAxis.categories[linkedTo: 0][this.point.y] + '</b><br>' + 
                            'Average Labour Rate: <b>' + '$'+Highcharts.numberFormat(this.point.value, 2) + '</b><br>' + '<b>' + this.series.xAxis.categories[this.point.x];
                    }
                },

In the linked to section I have row average information and I'd like it to show in the tool tip for that row.

I'd like to make the end result (top line of the tool tip) to be something like:

Br. 20 yearly average: $12.34

I've searched everywhere and I've been unable to find a solution to this problem.

      formatter: function () {                    
          return '<b>' + this.series.yAxis.categories[this.point.y] + '</b> Yearly Average: <b>$' + 
               Highcharts.numberFormat(this.series.chart.yAxis[1].categories[this.point.y],2) + '</b><br>' + 
               'Average Labour Rate: <b>' + '$'+Highcharts.numberFormat(this.point.value, 2) + '</b><br>' + 
               '<b>' + this.series.xAxis.categories[this.point.x];
      }

It's odd that you can't get to the 2nd yAxis directly through the this.series object. But, you can get to it through the this.series.chart object.

http://jsfiddle.net/mgtook3o/2/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM