I have a nice javascript treemap and am able to add events for drilldown events like so:
JavaScript
x
9
1
series: [{
2
point: {
3
events: {
4
click: function(event){
5
alert(this.name);
6
alert(event.point);
7
}
8
}
9
I’m not able to add a similar event when drilling back up, when clicking the back button.
I tried:
JavaScript
1
22
22
1
Highcharts.chart('container1', {
2
chart : {
3
events : {
4
drillup : function(event){
5
alert("DA");
6
}
7
}
8
},
9
series: [{
10
point: {
11
events: {
12
click: function(event){
13
alert(this.name);
14
alert(event.point);
15
},
16
drillup : function(event){
17
alert("DA");
18
}
19
20
}
21
}
22
but neither the drillup in series nor chart seems to work, how can i achieve this?
https://jsfiddle.net/ofg9k3m8/6/
Advertisement
Answer
I found a workaround here: https://github.com/highcharts/highcharts/issues/9812
JavaScript
1
17
17
1
Highcharts.addEvent(Highcharts.Series, 'click', function() {
2
alert('drill down');
3
});
4
5
(function(H) {
6
H.wrap(H.seriesTypes.treemap.prototype, 'drillUp', function(proceed) {
7
// add code here to run before the drillup
8
alert('before drill up');
9
10
// proceed
11
proceed.apply(this, [].slice.call(arguments, 1));
12
13
// add code here to run after the drillup
14
alert('after drill up');
15
});
16
}(Highcharts))
17
Here’s the updated https://jsfiddle.net/k9c80za7/1/