0

I am new to Angular and was trying to implement below. I have created a data object in Angular component

@..
...
export class MyComponent{
drilldownDataSeries : {
's1' : {
      ...
},
's2' : {
   ...
}
}

then want to use this object in drilldown event of chart object. Setting up the chart options in ngOnInit().

this.chartOptions = {
   chart :{
          events : {
drilldown : function(e){
 //** here i want to use drilldownDataSeries  object in the callback function
}
 }
}
}```

here i want to use drilldownDataSeries  object in the callback function.
Roohafza
  • 79
  • 1
  • 7

1 Answers1

0

There are several ways to access drilldownDataSeries from the callback function, the easiest one is to use the arrow function. You can read more about this approach and about the other solutions in this thread: https://stackoverflow.com/a/20279485/12285185

...
     chart: {
           events: {
             drilldown: () => {
               console.log(this.drilldownData);
             }
           }
       },
...

Live demo:
https://stackblitz.com/edit/highcharts-angular-basic-line-jwwfd8

Mateusz Kornecki
  • 765
  • 6
  • 18