2014-02-11 83 views
0

我想創建一個圖表使用jqPlot它顯示每個小時的數據。 這工作正常,但正如你可以在jsfiddle中看到的,它沒有正確顯示第一個和最後一個數據點。它削減了一些圈子。jqPlot數據點被切斷

我使用這個代碼:

$(document).ready(function() { 
    var line1 = [ 
     ['08:00', 4], 
     ['09:00', 10], 
     ['10:00', 2], 
     ['11:00', 12], 
     ['12:00', 5], 
     ['13:00', 3], 
     ['14:00', 40], 
     ['15:00', 2], 
     ['16:00', 20], 
     ['17:00', 7] 
    ]; 
    var plot1 = $.jqplot('chart1', [line1], { 
     axes: { 
      xaxis: { 
       renderer: $.jqplot.DateAxisRenderer, 
       tickOptions: { 
        formatString: '%H:%M' 
       }, 
       tickInterval: '1 hour', 
       min: '08:00', 
       max: '17:00' 
      }, 
      yaxis: { 
       min: 0 
      } 
     }, 
     seriesColors: ["#996325"], 
     seriesDefaults: { 
      markerOptions: { 
       show: true, 
       style: 'circle', // circle, diamond, square, filledCircle. filledDiamond or filledSquare. 
       color: 'white', 
       lineWidth: 4, 
       size: 12, 
       shadow: true 
      } 
     }, 
     grid: { 
      background: '#365463', 
      gridLineColor: 'grey' 
     } 
    }); 

}); 

jsFiddle

我在做什麼錯? :(

回答

0

您可以修改你的分和你的x軸的最大值,以看到你的第一個和最後一個點的整圈。

xaxis:{ 
min: '07:45', 
max: '17:15' 
} 

見例如here

+0

是有可能得到xaxis標籤從'08:00'開始? – Gaardsholt