[英]how to handle mouse over event in legend in highcharts?
I am able to handle mouseover/mouseout event in donut slices .. Please check my code 我能够处理甜甜圈切片中的mouseover / mouseout事件..请检查我的代码
http://jsfiddle.net/nyhmdtb8/6/ http://jsfiddle.net/nyhmdtb8/6/
whenever I hover on any slice it grey out all slices expect the selected on ..can we do the same thing on mouse over of legend ? 每当我将鼠标悬停在任何切片上时,所有切片都会变灰,..我们可以在图例上的鼠标悬停上做同样的事情吗?
I want to select any legend it should highlight the selected slice and grey out all .. 我想选择任何图例,它应突出显示所选的切片并全部变灰。
$('#container').on('mouseenter','.highcharts-legend-item',function(event) {
console.log(event)
}).on('mouseleave','.highcharts-legend-item',function(event) {
});
I need to this same thing on legend mousehover 我需要在传奇鼠标悬停时进行同样的操作
mouseOver: function(e) {
var series = this.series;
console.log(series)
for (var i = 0; i < series.data.length; i++) {
var point = series.data[i];
console.log(point)
if (point == this) {
console.log('yes')
point.update({color: series.chart.options.colors[this.index]});
} else {
point.update({
color: '#CCCCCC'
});
}
}
return false;
},
Accordiong to this post , you can easily do it like this: 根据该帖子 ,您可以轻松地做到这一点:
$('#container').highcharts({
{
// ... your params
},
function(chart) {
$(chart.series).each(function(i, serie) {
$(serie.legendItem.element).hover(function() {
// on over
}, function() {
// on mouseout
});
});
}
});
You can find a provided example here: http://jsfiddle.net/vitorbarbosa/qpByN/ 您可以在此处找到提供的示例: http : //jsfiddle.net/vitorbarbosa/qpByN/
You also may check the first answer of the post linked and its example: http://jsfiddle.net/highcharts/Ha3Wr/ 您还可以检查链接的帖子的第一个答案及其示例: http : //jsfiddle.net/highcharts/Ha3Wr/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.