2017-02-21 69 views
0

我有一个网站显示了许多实时图形和仪表,最初都隐藏在抽屉内。这些图形是用plotly.js库制作的。仪表使用JustGage完成。对于集装箱的代码是这样的:Bootstrap隐藏元素在扩展时延伸到容器

<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

抽屉(和一般的布局)由bootstrap完成。什么导致容器破裂?我曾尝试玩流体排和容器属性,但无济于事。提前致谢。

回答

0

看来问题不在于Bootstrap,而是在Plotly中设置了一些布局选项。有趣的是,只有在加载隐藏的情况下,才能将图形大小调整为比容器大得多。