|
|
|
|
@ -501,6 +501,7 @@ through the following axis options:
|
|
|
|
|
minTickSize: array
|
|
|
|
|
timeformat: null or format string
|
|
|
|
|
monthNames: null or array of size 12 of strings
|
|
|
|
|
dayNames: null or array of size 7 of strings
|
|
|
|
|
twelveHourClock: boolean
|
|
|
|
|
|
|
|
|
|
Here "timeformat" is a format string to use. You might use it like
|
|
|
|
|
@ -508,41 +509,47 @@ this:
|
|
|
|
|
|
|
|
|
|
xaxis: {
|
|
|
|
|
mode: "time"
|
|
|
|
|
timeformat: "%y/%m/%d"
|
|
|
|
|
timeformat: "%Y/%m/%d"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
This will result in tick labels like "2000/12/24". The following
|
|
|
|
|
specifiers are supported
|
|
|
|
|
|
|
|
|
|
%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 (four digits)
|
|
|
|
|
This will result in tick labels like "2000/12/24". A subset of the
|
|
|
|
|
standard strftime specifiers are supported:
|
|
|
|
|
|
|
|
|
|
%a: weekday name (customizable)
|
|
|
|
|
%b: month name (customizable)
|
|
|
|
|
%p: am/pm, additionally switches %h/%H to 12 hour instead of 24
|
|
|
|
|
%d: day of month, zero-padded (01-31)
|
|
|
|
|
%e: day of month, space-padded ( 1-31)
|
|
|
|
|
%H: hours, 24-hour time, zero-padded (00-23)
|
|
|
|
|
%I: hours, 12-hour time, zero-padded (01-12)
|
|
|
|
|
%m: month, zero-padded (01-12)
|
|
|
|
|
%M: minutes, zero-padded (00-59)
|
|
|
|
|
%S: seconds, zero-padded (00-59)
|
|
|
|
|
%y: year (two digits)
|
|
|
|
|
%Y: year (four digits)
|
|
|
|
|
%p: am/pm
|
|
|
|
|
%P: AM/PM (uppercase version of %p)
|
|
|
|
|
|
|
|
|
|
Inserting a zero like %0m or %0d means that the specifier will be
|
|
|
|
|
left-padded with a zero if it's only single-digit. So %y-%0m-%0d
|
|
|
|
|
results in unambigious ISO timestamps like 2007-05-10 (for May 10th).
|
|
|
|
|
%w: weekday as number (0-6, 0 being Sunday)
|
|
|
|
|
|
|
|
|
|
You can customize the month names with the "monthNames" option. For
|
|
|
|
|
instance, for Danish you might specify:
|
|
|
|
|
|
|
|
|
|
monthNames: ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"]
|
|
|
|
|
|
|
|
|
|
Similarly you can customize the weekday names with the "dayNames"
|
|
|
|
|
option. An example in French:
|
|
|
|
|
|
|
|
|
|
dayNames: ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"]
|
|
|
|
|
|
|
|
|
|
If you set "twelveHourClock" to true, the autogenerated timestamps
|
|
|
|
|
will use 12 hour AM/PM timestamps instead of 24 hour.
|
|
|
|
|
|
|
|
|
|
The format string and month names are used by a very simple built-in
|
|
|
|
|
format function that takes a date object, a format string (and
|
|
|
|
|
optionally an array of month names) and returns the formatted string.
|
|
|
|
|
If needed, you can access it as $.plot.formatDate(date, formatstring,
|
|
|
|
|
monthNames) or even replace it with another more advanced function
|
|
|
|
|
from a date library if you're feeling adventurous.
|
|
|
|
|
will use 12 hour AM/PM timestamps instead of 24 hour. This only
|
|
|
|
|
applies if you have not set "timeformat". Use the "%I" and "%p" or
|
|
|
|
|
"%P" options if you want to build your own format string with 12-hour
|
|
|
|
|
times.
|
|
|
|
|
|
|
|
|
|
If the Date object has a strftime property (and it is a function), it
|
|
|
|
|
will be used instead of the built-in formatter. Thus you can include
|
|
|
|
|
a strftime library such as http://hacks.bluesmoon.info/strftime/ for
|
|
|
|
|
more powerful date/time formatting.
|
|
|
|
|
|
|
|
|
|
If everything else fails, you can control the formatting by specifying
|
|
|
|
|
a custom tick formatter function as usual. Here's a simple example
|
|
|
|
|
|