在使用echarts绘制图表时,出现如下报错,导致图表无法绘制出来:
[v_warn][ECharts] Can’t get DOM width or height. Please check dom.clientWidth and dom.clientHeight. They should not be 0.For example, you may need to call this in the callback of window.onload.[/v_warn]
原因
原因很简单,就是获取不到绘制存放图表的容器的宽度和高度。

程序员导航
优网导航旗下整合全网优质开发资源,一站式IT编程学习与工具大全网站
解决办法
给绘制存放图表的容器设置宽高就可以了,比如:
<div id="chart" style="width:100px;height:100px"></div>
然后再去运行就可以正常绘制出echarts图表了。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...