我有一个显示许多实时图表和仪表的网站,最初都藏在抽屉里。图表是使用plotly.js库完成的。仪表由JustGage完成。容器的代码如下:
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-5 statistics">
<div class="centered-text">
<div class="container-fluid">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-heading">Statistics Panel</h3>
</div>
<ul class="list-group">
<!-- Base Station Panel -->
<li class="list-group-item">
<div class="row toggle" id="dropdown-detail-1" data-toggle="detail-1">
<div class="col-lg-10 text-left">
Base Station
</div>
<div class="col-lg-2"><i class="fa fa-chevron-down pull-right"></i></div>
</div>
<div id="detail-1">
<hr></hr>
<div class="container-fluid">
<div class="fluid-row">
<div class="col-lg-6">
<div id="happygraph1"></div>
<input id="happybutton1" type="button" value="View History"
onclick="happygraph1.changeMode();"/>
</div>
<div class="col-lg-6">
<div id="happygraph2"></div>
<input id="happybutton2" type="button" value="View History"
onclick="happygraph2.changeMode();"/>
</div>
</div>
<div class="fluid-row">
<div class="col-lg-6">
<div id="happygraph3"></div>
<input id="happybutton3" type="button"
value="View History" onclick="happygraph3.changeMode();"/>
</div>
</div>
<div class="container-fluid">
<div class="fluid-row">
<div class="col-sm-6">
<div id="happygauge1 style="height: 250px; width: 300px;"></div>
</div>
</div>
<div class="col-sm-6">
<div id="happygauge2" style="height: 250px; width: 300px;"></div>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
问题在于,当页面加载时,如果数据在隐藏元素展开之前开始出现在图形上,则图形的容器会扩展出新扩展的元素。但是,如果首先展开元素,然后数据进入,它就会完全按照它的方式行事。仪表没有问题。
以下是工作时的截图: graph containers stay within element
以下是在数据开始绘制后展开元素的截图:graph containers expand out of element
抽屉(以及一般的布局)由引导程序完成。是什么导致容器破裂?我试过玩流体行和容器属性,但无济于事。提前谢谢。
答案 0 :(得分:0)
似乎问题根本不在于Bootstrap,而在Plotly中设置了一些布局选项。只有在加载隐藏时,Plotly才会将图形调整为比容器大得多。