<ReactEcharts onChartReady={this.onChartReady}/>
onChartReady(echart) {
echart.getZr().on('click',params=>{
const pointInPixel = [params.offsetX, params.offsetY];
if (echart.containPixel('grid',pointInPixel)) {
let xIndex = echart.convertFromPixel({seriesIndex:0},[params.offsetX, params.offsetY])[0];
/*事件处理代码书写位置*/
let score = this.props.xData[xIndex];
this.props.showYear(score);
}
});
}