2017-02-21 91 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中設置了一些佈局選項。有趣的是,只有在加載隱藏的情況下,才能將圖形大小調整爲比容器大得多。