在g2 chart注册的event中,如何调用本页面export default中的method
zx8713 opened this issue · comments
Frank Zhang commented
我需要给chart注册plotclick事件,单击时刷新页面中的一个组件数据,但是在export default外层调不到里面的method方法,从而无法动态修改vue中的与页面绑定的数据
Yuan Zhu commented
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;
//...
});
})