fireyy / g2-vue

This Project Is Deprecated. Use [Viser](https://github.com/viserjs/viser) instead. Factory wrapper for using G2 easily in a Vue Component.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

在g2 chart注册的event中,如何调用本页面export default中的method

zx8713 opened this issue · comments

我需要给chart注册plotclick事件,单击时刷新页面中的一个组件数据,但是在export default外层调不到里面的method方法,从而无法动态修改vue中的与页面绑定的数据

createG2 的回调里可以通过 chart 注册事件,比如:

const LineChart = createG2(chart => {
  chart.line().position('time*pm25').color('pm25').shape('spline').size(2)
  chart.render()
  chart.on('plotclick',function(ev){
    var data = ev.data;
    //...
  });
})