1.问题描述:
echart图片不显示
图片:
2.解决方法:
2.1第一步
给wxml中的ec-canvas组件添加宽高样式:style="width: 100%; height: 500px;"
原本代码:
<view class="container"> <ec-canvas id="mychart-dom-graph" canvas-id="mychart-graph" ec="{{ ec }}"></ec-canvas> </view>
修改后代码:
<view class="container"> <ec-canvas id="mychart-dom-graph" style="width: 100%; height: 500px;" canvas-id="mychart-graph" ec="{{ ec }}"></ec-canvas> </view>
2.2第二步
给wxss外层容器添加以下样式:
.container { position: absolute; top: 0; bottom: 0; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; box-sizing: border-box; }
2.2效果