http://jsfiddle.net/leongaban/n36y336z/
我在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';
}
}
}],
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句