莫里斯栏仅在活动选项卡上显示,而在其他选项卡上不显示

时间:2018-11-14 06:50:46

标签: jquery morris.js

我正在使用标签上的莫里斯栏。

<div class="row">
  <div class="col s12">
     <ul class="tabs tab-demo-active z-depth-1 cyan">
        <li class="tab col s3"><a class="white-text waves-effect waves-light active" href="#today">Today</a>
        </li>
        <li class="tab col s3"><a class="white-text waves-effect waves-light" href="#yesterday">Yesterday</a>
        </li>
     </ul>
  </div>
<div class="col s12">
  <div id="today" class="col s12   lighten-4">
    <div class="col s12 m12 l12 card-panel">
      <div id="morris-bar-chart" class="section">
         <div class="col s12 m12 l12">
           <div class="sample-chart-wrapper">
              <div id="morris-bar" class="graph"></div>
            </div>
          </div>
        </div>               
      </div>     
   </div>
<div id="yesterday" class="col s12   lighten-4">
  <div class="col s12 m12 l12 card-panel">
    <div id="morris-bar-chart" class="section">
      <div class="col s12 m12 l12">
        <div class="sample-chart-wrapper">
          <div id="morris-bar1" class="graph"></div>
        </div>
      </div>
    </div>               
   </div>
  </div>
 </div>

  

这是morris-script.js代码

$(function() {
  $(window).on("load", GetAllProperties);
  function GetAllProperties() { 
  $.ajax({
    url: "today_attendance.php",
    dataType: 'JSON',
    type: 'POST',
    success: function(response)
  { var i=0;
    Morris.Bar({
    element: 'morris-bar',
    data: response,
    xkey: 'x',
    ykeys: ['y', 'z'],
    //labels: [response[0].a, response[0].b]
    labels: ['MOD-1', 'MOD-2']
    }); 
   }
 });
 $.ajax({
  url: "yesterday_attendance.php",
  dataType: 'JSON',
  type: 'POST',
  success: function(response)
  { var i=0;
    Morris.Bar({
    element: 'morris-bar1',
    data: response,
    xkey: 'x',
    ykeys: ['y', 'z'],
    //labels: [response[0].a, response[0].b]
    labels: ['MOD-1', 'MOD-2']       
    });
    }
 });
 }
});

问题是,莫里斯栏仅显示在活动标签上,而不显示在其他标签上。 我也尝试使用jQuery和JavaScript在div上显示和隐藏按钮单击,但是在单击按钮时仍然无法显示morris栏所面临的问题。 如何在所有标签上显示莫里斯酒吧?

0 个答案:

没有答案