2016-07-20 29 views
2

我的點沒有出現在中心與x軸的網格線在下面的屏幕截圖爲可見:jQuery的Flot.js:折線圖表點不與x軸網格線爲中心

enter image description here

是我使用的選項如下:

var options = { 
     grid: { 
     show: true, 
     aboveData: false, 
     color: "#3f3f3f", 
     labelMargin: 10, 
     axisMargin: 0, 
     borderWidth: 0, 
     borderColor: null, 
     minBorderMargin: 5, 
     clickable: true, 
     hoverable: true, 
     autoHighlight: true, 
     mouseActiveRadius: 100 
     }, 
     series: { 
     lines: { 
      show: true, 
      fill: true, 
      lineWidth: 2, 
      steps: false 
     }, 
     points: { 
      show: true, 
      radius: 4.5, 
      symbol: "circle", 
      lineWidth: 3.0 
     } 
     }, 
     legend: { 
     position: "ne", 
     margin: [0, -15], 
     noColumns: 0, 
     labelBoxBorderColor: null, 
     labelFormatter: function(label, series) { 
      // just add some space to labes 
      return label + '  '; 
     }, 
     width: 40, 
     height: 1 
     }, 
     colors: chartColours, 
     shadowSize: 0, 
     tooltip: true, //activate tooltip 
     tooltipOpts: { 
     content: "%s: %y.0", 
     xDateFormat: "%d/%m", 
     shifts: { 
      x: -30, 
      y: -50 
     }, 
     defaultTheme: false 
     }, 
     yaxis: { 
     min: 0, 
     tickDecimals:0 
     }, 
     xaxis: { 
     mode: "time", 
     minTickSize: tickSize, 
     timeformat: tformat, 
     min: chartMinDate, 
     max: chartMaxDate 
     } 
    }; 

我的數據集是一個時間序列,以及標籤值也從相同的數據集,因此日期應排隊與未來點。然而,它被抵消,而沒有選擇這個存在。我究竟做錯了什麼?

+0

你找到這個問題的解決? –

+0

我沒有。我可能很快會再次看到這樣的內容,如果我找到解決方案,我會在這裏發佈。 – AliIshaq

回答

1

我從這個鏈接

points aren't aligned with the x axis on flot chart

而且

https://code.google.com/archive/p/flot/issues/608

看來海軍報圖需要UTC格式的時間解決。

對於我來說,在 「xaxis」 工作僅僅通過增加 「timezone:"browser"」。

加入後,我的「x軸」看起來象下面這樣:

xaxis: { 
      mode: "time", 
      minTickSize: [1, "day"], 
      timeformat: "%d-%b-%y", 
      timezone:"browser", 
      min: min date value define here, 
      max: max date value define here 
     }