说明:
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 <a href="#" class="comment_triger">Comment</a> On <b>' + this.x +
'</b> = <b>' + this.y + '</b>';
},
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");
})
});