微信小程序echart导出图片

echarts版本5.1.0

用到的echarts组件是uni插件市场的echart组件

html 复制代码
<div style="overflow: hidden;">
			<dCanvas class="uni-ec-canvass" id="uni-ec-canvas" ref="canvas" canvas-id="mychart-gauge" :ec="ec">
			</dCanvas>
		</div>
javascript 复制代码
		initChart(canvas, width, height, canvasDpr) {
				let that = this;
				let ecComonnets = this.selectComponent('#uni-ec-canvas')
				console.log('ecComonnets', ecComonnets);

				chart = echarts.init(canvas, null, {
					width: width,
					height: height,
					devicePixelRatio: canvasDpr
				})
				canvas.setChart(chart)
                setTimeout(function() {
					console.log('asdad', ecComonnets);
					ecComonnets.$vm.canvasToTempFilePath({
						x: 0,
						y: 0,
						width: 290,
						height: 180,
						canvasId: 'myShareCanvas',
						success: function(res) {
							console.log('res.tempFilePath', res.tempFilePath);
							that.$store.commit('set_caseShareEchartPicList', [...that.caseShareEchartPicList, res.tempFilePath])
						},
						fail: function() {
							console.log("echarts生成失败")
						}
					})
				}, 1500)

				return chart
			},

关键代码是

相关推荐
CHU7290353 分钟前
定制专属美丽时刻:美容预约商城小程序的贴心设计
前端·小程序
hnxaoli6 小时前
统信小程序(十)nutika打包elf格式程序
小程序
CHU7290356 小时前
家门口的邻里集市:社区团购小程序的功能探索
小程序
hnxaoli7 小时前
统信小程序(十一)快捷地址栏
linux·python·小程序
职豚求职小程序10 小时前
中国人保财险笔试如何通过?附刷题库小程序
小程序
chushiyunen10 小时前
python轻量级框架flask、做桌面小程序
python·小程序·flask
笨笨狗吞噬者11 小时前
【uniapp】小程序支持分包存放微信自定义组件 wxcomponents
前端·微信小程序·uni-app
蓝色心灵-海12 小时前
小律书 技术架构详解:前后端分离的自律管理系统设计
java·http·小程序·架构·uni-app
00后程序员张14 小时前
iPhone 无需越狱文件管理 使用Keymob查看导出文件
android·ios·小程序·https·uni-app·iphone·webview
毕设源码-朱学姐14 小时前
【开题答辩全过程】以 基于微信小程序的运动减肥管理系统设计与实现为例,包含答辩的问题和答案
微信小程序·小程序