Call an angular component method when we click on highchart series

前端 未结 3 1635
盖世英雄少女心
盖世英雄少女心 2021-01-05 07:14

I use angular2-highcharts and I want to call a component method in a local function but I don\'t know how it could be possible.

Could you help me ? A plunker examp

3条回答
  •  温柔的废话
    2021-01-05 07:49

    To have access to the informations that the click event returns and also have access to your component methods you can do something like this:

    plotOptions: {
                series: {
                    turboThreshold:3000,
                    cursor: 'pointer',
                    point: {
                        events: {
                            click: function(e){
                               const p = e.point
                               this.myComponentMethod(p.category,p.series.name);
                            }.bind(this)
                        }
                    }
                }
            },
    

    I hope this will help.

提交回复
热议问题