蝴蝶不菲
2023-03-24 15:41:22
我有一個(gè)直方圖類型的高圖,我需要在圖表事件更新函數(shù)中訪問(wèn)series[0].data以更改點(diǎn)顏色。我可以在谷歌開發(fā)工具中看到series[0].data包含我所有點(diǎn)的數(shù)組,但實(shí)際上在 JS 代碼中得到一個(gè)空數(shù)組。點(diǎn)更新后顏色不變。示例:jsfiddle
1 回答

RISEBY
TA貢獻(xiàn)1856條經(jīng)驗(yàn) 獲得超5個(gè)贊
沒(méi)有這樣的事件chart.events.update
。改用渲染 - API: https: //api.highcharts.com/highcharts/chart.events.render
演示: https: //jsfiddle.net/BlackLabel/csdnh6e3/
chart: {
events: {
render: function() {
console.log('data :', this.series[0].data);
this.series[0].data.forEach(data => data.update({
color: '#0f5'
}, false)); // after the update() color of points does not change
}
}
},
添加回答
舉報(bào)
0/150
提交
取消