Highcharts test tool

by Torstein Hønsi

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="min-width: 300px; height: 300px; margin: 1em"></div>

JavaScript

(function (H) {
    
    H.Tooltip.prototype.pin = function () {
        this._hide = this.hide;
        this._move = this.move;
        this._refresh = this.refresh;
        this.hide = function () {};
        this.move = function () {};
        this.refresh = function () {};
    };
    H.Tooltip.prototype.unpin = function () {
        this.hide = this._hide;
        this.move = this._move;
        this.refresh = this._refresh;
    };
    
    
}(Highcharts));

$('#container').highcharts({

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 
            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }]

});

// Pin/unpin the tooltip on container click
var pinned;
$('#container').bind('mousedown', function () {console.log(35)
    $('#container').highcharts().tooltip[pinned ? 'unpin' : 'pin']();
    pinned = !pinned;
});