Page 1 of 1

Drilldown event

Posted: Thu Nov 29, 2018 9:52 am
by brunano21
Hi,
I'm using a pie with drilldown series. I'm able to load the drilldown series asynchronously using the chartOptions.chart.events.drilldown function. However, I'd like to intercept any click event that occurs on a drilldown point but so far I have been that lucky. The docs did not help either. Any suggestion how I can achieve that?
Thanks.

Re: Drilldown event

Posted: Thu Nov 29, 2018 10:22 am
by rafalS
Hi, brunano21!

What do you mean saying "I'd like to intercept any click event that occurs on a drilldown point"? Are you looking for this?

Code: Select all

chart: {
    type: 'pie',
    events: {
      drilldown(e) {
        console.log(e) // Event
        console.log(this) // Chart
      }
    }
  },
jsFiddle: https://jsfiddle.net/BlackLabel/tbz2auj1/

Best regards!

Re: Drilldown event

Posted: Thu Nov 29, 2018 10:25 am
by brunano21
Hi rafaIS,

Thanks for the quick answer. This is already what I'm doing. But if click again on one of the drilldown points, the drilldown function is not invoked.

Re: Drilldown event

Posted: Thu Nov 29, 2018 10:36 am
by rafalS
You have 2 series objects in options - main series and drilldown series. You can use click event inside drilldown series like in this example: https://jsfiddle.net/BlackLabel/krfjs1nz/

Re: Drilldown event

Posted: Thu Nov 29, 2018 10:40 am
by brunano21
Awesome, this is what I have been looking for!

Thank you very much!

Code: Select all

...
  "drilldown": {
    "series": [{
        point: {
          events: {
            click() {
              console.log('Below is point clicked after drilldown')
              console.log(this)
            }
          }
        },
        "name": "Chrome",
        "id": "Chrome",
        "data": [ ... ]
...

Re: Drilldown event

Posted: Thu Nov 29, 2018 10:41 am
by rafalS
You're welcome ;)