beezen/echarts4taro3

该插件有没有生成图表图片的方法?

Closed this issue · 1 comments

折线图等canvas转成图片,echarts api方法 getDataURL(),好像在taro里没法使用,有没有提供相应方法?

暂时按以下方式处理的:

nextTick(async () => {
    const echartsInstance = await classRatioChangeChartsRefs.value[index].refresh(option)
    setTimeout(() => {
      wx.canvasToTempFilePath(
        {
          canvas: echartsInstance._dom.canvasNode,
          quality: 1,
        },
        instance, // const instance = getCurrentInstance()
      )
        .then((res) => {
          classRatioChangeChartsImg.value[index] = res.tempFilePath
        })
        .catch(console.log)
    }, 1000)
  })