gpt4 book ai didi

javascript - 如何在鼠标悬停之前隐藏 highChart plotLine 标签?

转载 作者:行者123 更新时间:2023-11-29 10:34:51 25 4
gpt4 key购买 nike

http://jsfiddle.net/leongaban/n36y336z/

enter image description here

我的 highChart 上有一个情节系列,它有一个标签。我想要做的是隐藏标签直到鼠标悬停。以前有人尝试过吗?

$(function() {
var $report = $('#report');

$('#container').highcharts({
xAxis: {
plotLines: [{ // mark the weekend
color : 'rgba(254,235,236,0.5)',
from : Date.UTC(2010, 0, 2),
to : Date.UTC(2010, 0, 3),
zIndex: 1,
label: {
text : 'Event',
align : 'left',
style : { color: '#000' },
visible : false
},
events: {
click: function(e) {
console.log('clicked event')
},
mouseover: function(e) {
console.log('show plotline label')
},
mouseout: function(e) {
console.log('hide plotline label')
}
}
}],
tickInterval: 24 * 3600 * 1000,
type: 'datetime'
},

series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4],
pointStart: Date.UTC(2010, 0, 1),
pointInterval: 24 * 3600 * 1000
}]
});
});

最佳答案

使用display代替visible

plotLines: [{ // mark the weekend
label: {
text: 'label',
style: {
display: 'none'
}
},
events: {
mouseover: function (e) {
this.label.element.style.display='block';
},
mouseout: function (e) {
this.label.element.style.display='none';
}
}
}],

JSFiddle demo

关于javascript - 如何在鼠标悬停之前隐藏 highChart plotLine 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38616712/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com