2020-12-18echarts空白の領域をクリックします

echarts getZr()メソッドは、キャンバス全体を監視し、クリックイベントでそれを使用して、echarts画像の空白の領域をクリックします。

 const bimAxisDom: any = this.$refs.threeModelAxis
        this.bimAxisChart = echarts.init(bimAxisDom as HTMLCanvasElement)
        let _this = this
        // 点击
        this.bimAxisChart.getZr().on('click', (params: any) => {
            const pointInPixel = [params.offsetX, params.offsetY]
            if (this.bimAxisChart.containPixel('grid', pointInPixel)) {
                _this.xIndex = this.bimAxisChart.convertFromPixel({ seriesIndex: 0 }, [params.offsetX, params.offsetY])[0]
                _this.mouseDown()
            }
        })

 

おすすめ

転載: blog.csdn.net/qq_39139322/article/details/111369007