myChart.setOption(option)
window.addEventListener('resize', function()
{
myChart.resize()
})
myChart.getZr().off('click')
myChart.getZr().on('click', params =>
{
let pointInpixel = [params.offsetX, params.offsetY]
let xIndex
if (myChart.containPixel('grid', pointInpixel))
{
xIndex = myChart.convertFromPixel({seriesIndex: 0}, pointInpixel)[0]
//xIndex 即为x轴数据数组下标
}
})
echarts渲染图表(添加点击事件,清除点击事件)
最新推荐文章于 2024-03-05 14:12:51 发布