Highcharts.chart('container', {
chart: {
events: {
drilldown: function(e) {
console.log(this)
var chart = this,
drilldowns = chart.userOptions.drilldown.series,
series = [];
Highcharts.each(drilldowns, function(p, i) {
if (p.id === e.point.name) {
chart.addSingleSeriesAsDrilldown(e.point, p);
}
});
chart.applyDrilldown();
chart.update({
chart: {
type: 'column'
}
})
},
drillup: function() {
let chart = this;
console.log(this)
chart.update({
chart: {
type: 'treemap',
}
})
}
}
},
legend: {
enabled: true
},
series: [{
animation: false,
type: "treemap",
data: [{
id: 'B',
name: 'Bananas',
color: "#ECE100"
}, {
name: 'Anne',
parent: 'B',
value: 3,
drilldown: true
}, {
name: 'Rick',
parent: 'B',
value: 10,
drilldown: 'BRickSales'
}, {
name: 'Peter',
parent: 'B',
value: 1
}]
}],
drilldown: {
series: [{
name: 'Ricks quotes',
id: 'Rick',
type: 'column',
data: [
['v11', 30],
['v8', 17],
['v9', 8],
['v10', 5],
['v7', 3]
]
}, {
name: 'Rick Calls',
id: 'Rick',
type: 'line',
data: [
['v11', 50],
['v8', 40],
['v9', 60],
['v10', 65],
['v7', 73]
]
}, {
name: 'Anne quotes',
id: 'Anne',
type: 'column',
data: [
['v11', 2],
['v8', 7],
['v9', 3],
['v10', 5],
['v7', 3]
]
}, {
name: 'Anne Calls',
id: 'Anne',
type: 'line',
data: [
['v11', 50],
['v8', 40],
['v9', 60],
['v10', 65],
['v7', 73]
]
}]
},
});