【发布时间】:2025-11-23 14:10:02
【问题描述】:
我创建了一个自定义Highcharts drawing,我目前拥有它,如果用户将鼠标悬停在一个元素上,它会显示一个标签。但是,我想在 mouseout 上删除标签。
这是我目前所拥有的:
$('#container').highcharts({
chart: {
backgroundColor: 'white',
events: {
load: function () {
var ren = this.renderer;
ren.rect(50, 50, 60, 50, 0)
.attr({
'stroke-width': 2
})
.on('mouseover', function() {
ren.label('Foo')
.attr({
fill: Highcharts.getOptions().colors[0],
padding: 10,
r: 5,
zIndex: 8
})
.css({
color: '#fff'
})
.add();
})
.on('mouseout', function() {
// need to remove the Foo label here
})
.add();
}
}
}
}
});
有什么想法吗?
【问题讨论】:
-
如果您可以设置fiddle 然后编辑您的问题以将其置于顶部,这将有所帮助
标签: javascript highcharts