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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With