您可以访问/通过chart.options.drilldown.series
覆盖数据。例如:
$('#button').click(function() {
// force highchart to close a open drilldown
// otherwise the data will not be updated, or
// chart will not work any longer
if (chart.drilldownLevels.length > 0) {
chart.drillUp();
}
chart.series[0].setData([10]);
// structure to replace the old data
var newdrilldown = [{
id: 'item1',
data: [
{
name: 'Condition 1',
y: 10
},
{
name: 'Condition 2',
y: 5,
},
{
name: 'Condition 3',
y: 1,
}]
}];
// here you access your drilldown
chart.options.drilldown.series = newdrilldown;
});
如果你不想在你里面去chart.options.drilldown.series[0].data = []
等来代替完整的块,但只是数据。
您的更新fiddle is here。
刷新数据后,下钻不再有效? – user813813
@ user813813我想我已经找到你的意思了,如果你在挖掘打开的情况下添加/操作数据,highcharts会停止工作 - 你必须先关闭它,看到更新后的答案和小提琴 –