Highcharts大型树形图如何动态更改allowDrillToNode标志?
我使用格式化程序来显示/隐藏数据标签。现在我想在单击按钮时手动更改allowDrillToNode标志,我不想再次渲染图表Highcharts大型树形图如何动态更改allowDrillToNode标志?,highcharts,Highcharts,我使用格式化程序来显示/隐藏数据标签。现在我想在单击按钮时手动更改allowDrillToNode标志,我不想再次渲染图表 self.Model.marketMapChartInfo = { series: [{ type: "treemap", layoutAlgorithm: 'squarified', allowDrillToNode: true, layoutStartingD
self.Model.marketMapChartInfo = {
series: [{
type: "treemap",
layoutAlgorithm: 'squarified',
allowDrillToNode: true,
layoutStartingDirection: "horizontal",
dataLabels: {
enabled: true,
useHTML: true,
style: {
fontFamily: 'isw',
fontSize: '13px',
},
formatter: null
},
levelIsConstant: false,
levels: [{
level: 1,
dataLabels: {
enabled: true,
useHTML: true,
style: {
fontFamily: 'isw',
fontSize: '13px',
},
formatter: null
},
borderWidth: 1
}],
data: null,
events: {
click: function (event) {
console.log("Node clicked!");
}
}
}]
}
self.Model.MarketMapLargeTreeMap = Highcharts.chart('market-map-large-tree-map', self.Model.marketMapChartInfo);
这些是单击按钮时执行的代码。通过这些代码,我可以处理是否标记的显示,但是我不能使用allowDrillToNode标志
self.Model.marketMapChartInfo.series[0].dataLabels.formatter = function () {
if (self.Model.allocationParam != "sector") {
return '<div class="text-center" dir="auto"><span>' + this.point.name + '</span>' +
'<br>' +
'<span>' + Highcharts.numberFormat(this.point.value, 0) + '</span></div>';
} else {
return null;
}
};
self.Model.marketMapChartInfo.series[0].levels[0].dataLabels.formatter = function () {
if (self.Model.allocationParam == "sector") {
return '<div class="text-center" dir="auto"><span>' + this.point.name + '</span>' +
'<br>' +
'<span>' + Highcharts.numberFormat(this.point.value, 0) + '</span></div>';
} else {
return null;
}
};
$timeout(function () {
self.Model.MarketMapLargeTreeMap.series[0].isDirty = true;
self.Model.MarketMapLargeTreeMap.redraw();
}, 1);
self.Model.marketMapChartInfo.series[0].dataLabels.formatter=函数(){
if(self.Model.allocationParam!=“扇区”){
返回“”+this.point.name+“”+
“
”+
''+高位图表.numberFormat(this.point.value,0)+'';
}否则{
返回null;
}
};
self.Model.marketMapChartInfo.series[0]。级别[0]。dataLabels.formatter=函数(){
if(self.Model.allocationParam==“扇区”){
返回“”+this.point.name+“”+
“
”+
''+高位图表.numberFormat(this.point.value,0)+'';
}否则{
返回null;
}
};
$timeout(函数(){
self.Model.MarketMapLargeTreeMap.series[0].isDirty=true;
self.Model.MarketMapLargeTreeMap.redraw();
}, 1);
源代码:似乎需要更新allowTraversingTree
属性:
chart.series[0].update({
allowTraversingTree: false
});
现场演示: API参考: