-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
/**
* Highcharts plugin for setting a lower opacity for other series than the one that is hovered
* in the legend
*/
(function (Highcharts) {
var each = Highcharts.each;
Highcharts.wrap(Highcharts.Legend.prototype, 'renderItem', function (proceed, item) {
proceed.call(this, item);
var series = this.chart.series,
element = item.legendGroup.element;
type = this.chart.userOptions.chart.type;
if(type == 'pie'){ //pie default
return;
}
element.onmouseover = function () {
each(series, function (seriesItem) {
if (seriesItem !== item) {
each(['group', 'markerGroup'], function (group) {
seriesItem[group].attr('opacity', 0.25);
});
}
});
}
element.onmouseout = function () {
each(series, function (seriesItem) {
if (seriesItem !== item) {
each(['group', 'markerGroup'], function (group) {
seriesItem[group].attr('opacity', 1);
});
}
});
}
});
}(Highcharts));