You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/05/04 05:49:47 UTC

[GitHub] AntoniaQiao commented on issue #8228: 手动调用触发图表下载

AntoniaQiao commented on issue #8228: 手动调用触发图表下载
URL: https://github.com/apache/incubator-echarts/issues/8228#issuecomment-386510907
 
 
   可以的,
   
   this.myChart = echarts.init(document.getElementById('observable-chart' + this.index));   // 实例化
   const url = this.myChart.getDataURL({
           pixelRatio: 2,
           backgroundColor: '#fff'
         });
   
   下载 
    downLoadChart(url) {
       const a = document.createElement('a');
       a.setAttribute('href', url);
       a.setAttribute('download', 'export');
       a.style.visibility = 'hidden';
       document.body.appendChild(a);
       a.click();
       document.body.removeChild(a);
     }

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org