2013-10-11 71 views
0

新手問題。使用flot jquery庫我試圖設置系列選項,但是我收到一個錯誤:series: {行上的「意外標識符」。我想關注https://github.com/flot/flot/blob/master/API.md#plot-options。有沒有我不理解的東西?Flot:系列是選項中的意外標識

<!DOCTYPE html> 
<html> 
<head> 
    <title>Flot Graph Testing</title> 
    <script src="jquery-2.0.3.js"></script> 
    <script src="jquery.flot.js"></script> 
    <script type="text/javascript"> 

    $(function() { 

     var options = { 
      grid: { 
       show: false 
      } 
      series: { 
       bars: { 
        show:true 
       } 
      } 
     }; 

     var rawdata = [[0, 3], [2, 8], [4, 5], [6, 13]]; 
     var data = [{data: rawdata }] 
     $.plot("#placeholder", data, options); 

     // Add the Flot version string to the footer 

     $("#footer").prepend("Flot " + $.plot.version + " &ndash; "); 
    }); 

    </script> 
</head> 

<body> 
    <div id="header"> 
     <h2>Flot graph</h2> 
    </div> 

    <div id="content"> 
     <div class="container"> 
      <div id="placeholder" class="my-placeholder" style="width:600px;height:300px"></div> 
     </div> 
     <p>This is a flot graph</p> 
    </div> 
</body> 
</html> 

回答

2

你缺少一個逗號到options對象的屬性分開:

var options = { 
     grid: { 
      show: false 
     }, // <-- comma 
     series: { 
      bars: { 
       show:true 
      } 
     } 
    }; 
+0

阿權的感謝。我還不太習慣Javascript – Gak2