Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

highcharts: get yaxis title?

I have a graph with 2 yaxis and i am tying to get the yaxis title for each series in the tooltip formatter.

This is my formatter function:

formatter: function() {
    var s = '<b>'+  Highcharts.dateFormat('$hc_date_long', this.x) +'</b><table>';
    sum = 0;
    var abweichung = 0;
    var stellen = 0;
    $.each(this.points, function(i, point) {
        var prev = jQuery.inArray(point.x, point.series.processedXData)-1;
        var percent = 0;
        if(prev>=0){
            prev = point.series.points[prev];
            percent = (point.y - prev.y) * 100 / point.y;
        }
        s += '<tr><td style=\"color: '+point.series.color+';padding:2px;\">'+ point.series.name +':</td><td style=\"text-align:right;padding:2px;\"> '+ extround(point.y,100) +' !!GETYAXISTITLE!!</td><td style=\"text-align:right;padding:2px;\">'+percent+'</td></tr>';
        sum += point.y;
    });
    s += '</table>';
     return s;
},

The api only contains the function "setTitle()" there is no getTitle() function?

like image 857
Mike Avatar asked Dec 07 '22 09:12

Mike


1 Answers

Correct way to get Y Axis title in tooltip formatter is :

this.point.series.yAxis.axisTitle.textStr
like image 117
Exlord Avatar answered Dec 25 '22 05:12

Exlord