明月笑刀無情
2021-11-04 15:17:15
我有一個(gè)已經(jīng)生成的氣泡圖。我需要根據(jù)用戶可以選擇的復(fù)選框在同一圖表上添加/刪除網(wǎng)格線。我嘗試了類似以下的方法,但沒有奏效。setTimeout(function () { var chart = $('#bubble-chart-container').highcharts(); chart.options.xAxis[0].gridLineWidth = 1; chart.options.yAxis[0].gridLineWidth = 1; chart.reflow();}, 500);
1 回答

幕布斯6054654
TA貢獻(xiàn)1876條經(jīng)驗(yàn) 獲得超7個(gè)贊
您將需要像這樣使用chart.update(API 鏈接)方法:
HTML
<div id="container"></div>
<button id="addButton">Add lines</button>
<button id="removeButton">Remove lines</button>
Javascript
var chart = Highcharts.chart('container', {
...
});
$('#addButton').click(function() {
chart.update({
xAxis:{
gridLineWidth: 1
},
yAxis:{
gridLineWidth: 1
}
});
});
$('#removeButton').click(function() {
chart.update({
xAxis:{
gridLineWidth: 0
},
yAxis:{
gridLineWidth: 0
}
});
});
添加回答
舉報(bào)
0/150
提交
取消