19

この例では、xaxis で日を比較します...

$.plot($("#placeholder"), data, {
                yaxis: {},
                xaxis: { mode: "time",minTickSize: [1, "day"],timeformat: "%d/%m/%y"},"lines": {"show": "true"},"points": {"show": "true"},clickable:true,hoverable: true
            });

時間を印刷するにはどうすればよいですか?

これは私が望む結果です:

22:00 23:00 00:00 01:00 02:00 ...... 23:00 00:00 01:00 02:00 .... 06:00

出来ますか?

4

2 に答える 2

59

Flot の Api 公式ドキュメントから: ( https://github.com/flot/flot/blob/master/API.mdを参照)

  xaxis: {
    mode: "time",
    timeformat: "%y/%m/%d"
  }

これにより、「2000/12/24」のような目盛りラベルが作成されます。次の指定子がサポートされています

 %h: hours
  %H: hours (left-padded with a zero)
  %M: minutes (left-padded with a zero)
  %S: seconds (left-padded with a zero)
  %d: day of month (1-31), use %0d for zero-padding
  %m: month (1-12), use %0m for zero-padding
  %y: year (2 digits)
  %Y: year (4 digits)
  %b: month name (customizable)
  %p: am/pm, additionally switches %h/%H to 12 hour instead of 24
  %P: AM/PM (uppercase version of %p)
于 2011-01-21T16:31:57.690 に答える
20
$.plot($("#placeholder"), data, {
        yaxis: {
        },
        xaxis: { mode: "time",minTickSize: [1, "hour"],
                min: (new Date("2000/01/01")).getTime(),
                max: (new Date("2000/01/02")).getTime()
},
        "lines": {"show": "true"},
        "points": {"show": "true"},
        clickable:true,hoverable: true
});

これを出発点として使用すると、ここで結果を確認できますhttp://jsfiddle.net/UEePE/

于 2010-03-24T14:25:16.250 に答える