Search code examples
highchartstooltip

How to show the value of all linked axes in tool tip in highcharts?


I have linked two x axis to my master x axis and I want to be able to show all three axis in the tool tip. How can I achieve this?


Solution

  • Example how to get categories of all axes: http://jsfiddle.net/h295m/1/

    Code:

            tooltip: {
                formatter: function() {
                    var p = this.point,
                        s = p.series,
                        c = s.chart,
                        axes = c.xAxis,
                        aLen = axes.length,
                        i = 0,
                        str = '';
    
                    for(i; i < aLen; i++){
                        str += axes[i].categories[p.x] + '<br>'; 
                    }
    
                    str += s.name + ': ' + p.y; 
    
                    return str;
                }
            }