score:1

Accepted answer

You don't need to wrap any method, it is enough if you use formatter callback function:

    tooltip: {
        useHTML: true,
        formatter: function() {
            const chart = this.series.chart;
            const width = chart.plotWidth < 300 ? 100 : 200;

            return '<div style="width:' + width + 'px">' + this.y + '</div>'
        }
    }

Live demo: http://jsfiddle.net/BlackLabel/5kdonwbj/

API Reference: https://api.highcharts.com/highcharts/tooltip.formatter


Related Articles