![](/img/trans.png)
[英]change datalabels color in a HighCharts chart when hovering without updating the series
[英]Highcharts: how to change line color when hovering a scatterplot series
我有一個Highcharts散點圖。 圖表對象的一些詳細信息如下:
plotOptions: {
scatter: {
lineWidth:1,
marker: {
radius: 1,
symbol:'circle',
fillColor: '#800000',
states: {
hover: {
enabled: true,
radius:0,
radiusPlus:2,
lineColor: '#ff0000',
fillColor: '#ff0000'
}
}
},
states: {
hover: {
halo:false,
lineWidthPlus:2,
}
}
}
}
完整的工作例子在這里 。 將鼠標懸停在系列上時,我需要更改線條顏色,但是我無法做到這一點。 這可能嗎?
這可以通過事件輕松實現。
您需要做的就是在用戶將鼠標懸停在系列上時更新系列顏色屬性
events: {
mouseOver: function () {
this.chart.series[this.index].update({
color: 'red'
});
},
mouseOut: function () {
this.chart.series[this.index].update({
color: "#b0b0b0"
});
}
}
這將更改該點懸停的系列的顏色。
希望這對您有所幫助。
謝謝前鋒
@HalvorStrand已禁用粘性跟蹤?? 默認情況下啟用。 如果您有多個序列並且它們通過相同的xAxis點運行,我建議禁用粘性跟蹤。 –前鋒1月4日5:23
我一直在為此苦苦掙扎,直到我將其放在plotoptions series: {stickyTracking: false},
問題已解決
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.