自定义按钮 导出echarts图

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34169240/article/details/85156479
var myChart = echarts.init(document.getElementById('test'));
var i = myChart.getDataURL({
    type:'png',
    backgroundColor:'white'
    // 导出的图片分辨率比例,默认为 1。
    //pixelRatio: number,
 });
 var $a = document.createElement('a');
 $a.setAttribute("href", i);
 $a.setAttribute("download","test.png");
 $a.click();

猜你喜欢

转载自blog.csdn.net/qq_34169240/article/details/85156479
今日推荐