2016-07-20 104 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 
     }