简体   繁体   English

Highcharts热图yAxis具有2个类别。 如何在工具提示中显示两者?

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

I have a HighCharts HeatMap question. 我有一个HighCharts HeatMap问题。

How can I show two yAxis categories in the tooltip? 如何在工具提示中显示两个yAxis类别?

JSFiddle with my original code JSFiddle和我的原始代码

What I'd like to do is something like the following (lines 66 to 71 in jsfiddle): 我想做的事情如下所示(jsfiddle中的66至71行):

NB: [linkedTo: 0] 注意: [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. Br。 20 yearly average: $12.34 20年平均值: $ 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. 奇怪的是,您无法直接通过this.series对象到达第二个yAxis。 But, you can get to it through the this.series.chart object. 但是,您可以通过this.series.chart对象进行操作。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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