解决导出echarts图片数据不显示

解决方法有两个

1.由于数据加载采用的是异步的方式,可以设置延时,等待图片完全加载完之后再进行下载:

setTimeout(function () {
    let mySrc = getManage()
    let img = document.getElementById('myImg')
    img.src = mySrc.src
  }, 1000)

2.取消动画即在series中添加animation属性,设置为false

例如:

            series: [{
              data: this.value,
              type: 'bar',
                animation: false,
              itemStyle: {
                normal: {
                  color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                    offset: 0,
                    color: '#ecaa46'
                  },
                    {
                      offset: 1,
                      color: '#eccf39'
                    }
                  ])
                }
              }
            }]

这样使用dataUrl时就能够获取到他的全部图片.

 参考文档:https://www.freesion.com/article/9424911063/

 

posted on 2022-04-24 16:41  一往无前!  阅读(1178)  评论(0编辑  收藏  举报