将鼠标悬停在标记上时如何淡化高图中的其他 yAxises?
How to fade other yAxises in highchart when hover on marker?
如果将鼠标悬停在 Short Term Fuel Trim
上,其他情节线将淡化。我怎样才能对 yAxis 应用相同的效果,这将使 Short Term Fuel Trim
以外的其他 yAxis 淡化
您可以在 mouseOver
和 mouseOut
系列事件中使用 yAxis.update
方法来更改标题和标签颜色。
function updateYAxes(chart, exception, color) {
chart.yAxis.forEach(function(axis) {
if (axis !== exception) {
axis.update({
labels: {
style: {
color
}
},
title: {
style: {
color
}
}
}, false);
}
}, this);
chart.redraw();
}
Highcharts.chart('container', {
...,
plotOptions: {
series: {
events: {
mouseOver: function() {
updateYAxes(this.chart, this.yAxis, '#ededed');
},
mouseOut: function() {
updateYAxes(this.chart, this.yAxis, 'black');
}
}
}
}
});
现场演示: http://jsfiddle.net/BlackLabel/ju9g05xe/
API参考:
https://api.highcharts.com/highcharts/plotOptions.series.events.mouseOver
https://api.highcharts.com/highcharts/plotOptions.series.events.mouseOut
如果将鼠标悬停在 Short Term Fuel Trim
上,其他情节线将淡化。我怎样才能对 yAxis 应用相同的效果,这将使 Short Term Fuel Trim
您可以在 mouseOver
和 mouseOut
系列事件中使用 yAxis.update
方法来更改标题和标签颜色。
function updateYAxes(chart, exception, color) {
chart.yAxis.forEach(function(axis) {
if (axis !== exception) {
axis.update({
labels: {
style: {
color
}
},
title: {
style: {
color
}
}
}, false);
}
}, this);
chart.redraw();
}
Highcharts.chart('container', {
...,
plotOptions: {
series: {
events: {
mouseOver: function() {
updateYAxes(this.chart, this.yAxis, '#ededed');
},
mouseOut: function() {
updateYAxes(this.chart, this.yAxis, 'black');
}
}
}
}
});
现场演示: http://jsfiddle.net/BlackLabel/ju9g05xe/
API参考:
https://api.highcharts.com/highcharts/plotOptions.series.events.mouseOver
https://api.highcharts.com/highcharts/plotOptions.series.events.mouseOut