highcharts:tooltip提示框添加点击事件

说明:

highcharts的提示框中添加点击等事件

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

<div id="container" style="height: 400px">div>
JavaScript的 + jQuery 1.9.1

注意useHTML: true
style: {
pointerEvents: ‘all’
}

$(function () {
    $('#container').highcharts({
        tooltip: {
            followPointer:false,
            useHTML: true,
            backgroundColor: "#dddddd",
            formatter: function () {
                return 'Please Comment On ' + this.x +
                    ' = ' + this.y + '';
            },
            style: {
            	pointerEvents: 'all'
            }
        },

        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]
        }, {
            data: [194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4]
        }]
    });
    $(document).on('click', '.comment_triger', function(e) {
        e.preventDefault();
        alert("Yahooooooooooo");
    })  
});
预览

highcharts:tooltip提示框添加点击事件_第1张图片

你可能感兴趣的:(其他)