<div class="modal fade" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">统计</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div id="echart_line" style="height:250px;width: 450px"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
解决方法1. 去掉fade样式,可能是echarts不能在hidden的div渲染。
<div class="modal" tabindex="-1">
解决方法 2. 模态框显示事件中,重新初始化Echarts
$('.modal').on('show.bs.modal', function () {
myChart.resize()
})
解决方法 3. 检查模态框的Echarts容器有没有设置width和height
<div class="modal-body">
<div id="echart_line" style="height:250px;width: 450px"></div>
</div>
|