FLOT chart date and time on x-axis
14,946
Answer edited after understanding what the problem is:
The ticks on the x axis are not where your data points are (unless you use the ticks
option) but are evenly spaced over the range of your time values. If your data ranges over several days there will be only one tick per day and that tick will be at midnight.
To change this behaviour you can use the tickSize
option with something like
tickSize: [4, 'hour']
to generate a tick every 4 hours.
See here and here for more info in the documentation.
Author by
Satya
Updated on June 05, 2022Comments
-
Satya about 2 years
I'm using flot charts. I want to show date and time on x-axis. Here is my code:
$.plot($("#placeholder"), data, { xaxis: { mode: "time", timeformat:"%y/%m/%d %H:%M:%S" }, });
In the graph on x-axis shown as
14/07/15 00:00:00
. Time is not displayed. -
Raidri almost 10 years@user3514944 See my edit. I misunderstood your problem.
-
Raidri almost 10 yearsSorry, my fault. It's
tickSize
notticksize
. -
Satya almost 10 yearsok, I changed to tickSize but it is changing in the date only not in time format.It still shows time as 00:00
-
Raidri almost 10 yearsWith
tickSize: [4, 'hours']
and a wider placeholder div I get this: i.stack.imgur.com/zTJA5.png which shows the expected results