ReactEcharts点击事件在React中⽤Echarts画了⼀个环形图,如下。
现在想要实现⼀个点击事件
是这样的,
然后我是这样做的:
  onclick = {
'click': this.clickEchartsPie.bind(this)
}
clickEchartsPie(e) {
console.log(e)
}
render() {
setoption
return (
<div>
<ReactEcharts
option={hartsOptions}
style={{ width: '100%', height: "200px", borderWidth: "1px", borderColor: "red" }}
className={'react_for_echarts'}
ref={node => { hartspie = node }}
onEvents={lick}
/>
</div>
);
}
另⼀种⽅法:
initChart = (res) => {
let myChart = echarts.hartComp); //初始化echarts
//设置options
let chart =myChart.Option(res));
<('click', function (params) {
console.log(params);
});
this.setState({
chart
})
};