jquery - jqplot折线图中的错误

标签 jquery jquery-mobile jqplot

我有这段代码。我不知道为什么图表没有显示。正如控制台显示它正在绘制,但我无法显示它。 我相信我已经添加了容器,但不知道哪里出了问题。控制台没有显示任何错误。

<!DOCTYPE html>
 <html>
 <head>
 <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile- 

 1.4.2.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>




</head>
<body>

<div data-role="tabs">
  <div data-role="navbar">
    <ul>
      <li><a href="#one" data-theme="a" data-ajax="false">Price Grid</a></li>
      <li><a href="#two" data-theme="a" data-ajax="false">Price Chart</a></li>

    </ul>
</div>


    <div id="one" class="ui-content">

    <style>
         table,th,td
           {
             border:1px solid black;

           }
           th
             {
              background-color:green;
              color:white;
             }
       </style>



       <table id="myTable">


       </table>



    </div>

 <div id="two" style="height:400px;width:300px; "></div>

  <script language="javascript" type="text/javascript" src="../js/jqplot/jquery.min.js">

     </script>
 <script language="javascript" type="text/javascript" 
      src="../js/jqplot/jquery.jqplot.min.js"></script>

<link rel="stylesheet" type="text/css" href="../js/jqplot/jquery.jqplot.css" />

  <script type="text/javascript">

  $(function(){

  $.jqplot('two', [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);

 });
</script>



</div>




    </body>
  </html>

最佳答案

首先包括该死的框架,当jqplot链接不正确时,你期望它如何工作。 第二组 display: block !important; 到您的 div 容器 #two

工作示例:

<!DOCTYPE html>
 <html>
 <head>
 <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>

<div data-role="tabs">
  <div data-role="navbar">
    <ul>
      <li><a href="#one" data-theme="a" data-ajax="false">Price Grid</a></li>
      <li><a href="#two" data-theme="a" data-ajax="false">Price Chart</a></li>

    </ul>
</div>

    <div id="one" class="ui-content">

    <style>
         table,th,td
           {
             border:1px solid black;

           }
           th
             {
              background-color:green;
              color:white;
             }
             
             #two {
                height:400px;
                width:300px;
                display: block !important; 
             }
       </style>



       <table id="myTable">


       </table>



    </div>

 <div id="two" style=""></div>

  <script language="javascript" type="text/javascript" src="http://www.jqplot.com/src/jquery.min.js"></script>
  <script language="javascript" type="text/javascript" src="http://www.jqplot.com/src/jquery.jqplot.min.js"></script>
  <link rel="stylesheet" type="text/css" href="http://www.jqplot.com/src/jquery.jqplot.min.css" />

  <script type="text/javascript">

  $(function(){

  $.jqplot('two', [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);

 });
</script>



</div>




    </body>
  </html>

关于jquery - jqplot折线图中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23891442/

相关文章:

javascript - Jquery Mobile 和 Phonegap 的卡顿性能问题

javascript - 复选框 - jquery mobile 保守 secret

php - 如何使用 jquery 通过 ajax 发布元素值?

javascript - 使用 PHP 和 jQuery 上传图像时声明新的 formData()

javascript - 添加一个事件以在将列表项添加到 <select> jQuery 时捕获

html - 使用 Phonegap,哪个更好 : multiple html pages or multiple jquery-mobile pages?

javascript - 将数组元素重新排列成两个新数组

javascript - 如何显示 jqplot 图表区域的值而不是百分比

primefaces - p :chart with DateTime axis

javascript - 设置 Bxslider 以加载不同的图像?