柱状图的点击事件
<script type="text/javascript">
plotOptions :{ //设置显示对应y的值
series: {
cursor: 'pointer',
events: {
click: function(event) {
console.log(this.name);//this.name表示这是柱状图的service对应的name。
var year = chart.xAxis[0].categories[event.point.x];
//说明event.point.x表示点击x坐标对应索引(从0开始的)//说明chart.xAxis[0].categories为x坐标数组列表}
}
}
}
</script>