Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
flot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HS-public
flot
Commits
22ac76c0
Commit
22ac76c0
authored
Jun 15, 2012
by
Mark Cote
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated docs. Removed %u specifier.
parent
bffc2eea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
25 deletions
+40
-25
API.txt
API.txt
+31
-24
NEWS.txt
NEWS.txt
+9
-0
jquery.flot.time.js
jquery.flot.time.js
+0
-1
No files found.
API.txt
View file @
22ac76c0
...
@@ -501,6 +501,7 @@ through the following axis options:
...
@@ -501,6 +501,7 @@ through the following axis options:
minTickSize: array
minTickSize: array
timeformat: null or format string
timeformat: null or format string
monthNames: null or array of size 12 of strings
monthNames: null or array of size 12 of strings
dayNames: null or array of size 7 of strings
twelveHourClock: boolean
twelveHourClock: boolean
Here "timeformat" is a format string to use. You might use it like
Here "timeformat" is a format string to use. You might use it like
...
@@ -508,41 +509,47 @@ this:
...
@@ -508,41 +509,47 @@ this:
xaxis: {
xaxis: {
mode: "time"
mode: "time"
timeformat: "%
y
/%m/%d"
timeformat: "%
Y
/%m/%d"
}
}
This will result in tick labels like "2000/12/24". The following
This will result in tick labels like "2000/12/24". A subset of the
specifiers are supported
standard strftime specifiers are supported:
%h: hours
%a: weekday name (customizable)
%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)
%b: month 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)
%P: AM/PM (uppercase version of %p)
%w: weekday as number (0-6, 0 being Sunday)
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).
You can customize the month names with the "monthNames" option. For
You can customize the month names with the "monthNames" option. For
instance, for Danish you might specify:
instance, for Danish you might specify:
monthNames: ["jan", "feb", "mar", "apr", "maj", "jun", "jul", "aug", "sep", "okt", "nov", "dec"]
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
If you set "twelveHourClock" to true, the autogenerated timestamps
will use 12 hour AM/PM timestamps instead of 24 hour.
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
The format string and month names are used by a very simple built-in
"%P" options if you want to build your own format string with 12-hour
format function that takes a date object, a format string (and
times.
optionally an array of month names) and returns the formatted string.
If needed, you can access it as $.plot.formatDate(date, formatstring,
If the Date object has a strftime property (and it is a function), it
monthNames) or even replace it with another more advanced function
will be used instead of the built-in formatter. Thus you can include
from a date library if you're feeling adventurous.
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
If everything else fails, you can control the formatting by specifying
a custom tick formatter function as usual. Here's a simple example
a custom tick formatter function as usual. Here's a simple example
...
...
NEWS.txt
View file @
22ac76c0
...
@@ -15,6 +15,11 @@ control how the dates are displayed. If null, the dates are displayed
...
@@ -15,6 +15,11 @@ control how the dates are displayed. If null, the dates are displayed
as UTC. If "browser", the dates are displayed in the time zone of the
as UTC. If "browser", the dates are displayed in the time zone of the
user's browser.
user's browser.
Date/time formatting has changed and now follows a proper subset
of the standard strftime specifiers. Additionally, if a strftime
function is found in the Date object's prototype, it will be used
instead of the built-in formatter.
Axis labels are now drawn with canvas text with some parsing to
Axis labels are now drawn with canvas text with some parsing to
support newlines. This solves various issues but also means that they
support newlines. This solves various issues but also means that they
no longer support HTML markup, can be accessed as DOM elements or
no longer support HTML markup, can be accessed as DOM elements or
...
@@ -29,6 +34,10 @@ and "flot-overlay" to prevent accidental clashes (issue 540).
...
@@ -29,6 +34,10 @@ and "flot-overlay" to prevent accidental clashes (issue 540).
Changes:
Changes:
- Date/time formatting follows proper subset of strftime specifiers,
and support added for Date.prototype.strftime, if found (patch by
Mark Cote, issue 558).
- Fixed display of year ticks (patch by Mark Cote, issue 195).
- Fixed display of year ticks (patch by Mark Cote, issue 195).
- Support for time series moved to plugin (patch by Mark Cote).
- Support for time series moved to plugin (patch by Mark Cote).
...
...
jquery.flot.time.js
View file @
22ac76c0
...
@@ -60,7 +60,6 @@ for details.
...
@@ -60,7 +60,6 @@ for details.
case
'Y'
:
c
=
""
+
d
.
getFullYear
();
break
;
case
'Y'
:
c
=
""
+
d
.
getFullYear
();
break
;
case
'p'
:
c
=
(
isAM
)
?
(
""
+
"am"
)
:
(
""
+
"pm"
);
break
;
case
'p'
:
c
=
(
isAM
)
?
(
""
+
"am"
)
:
(
""
+
"pm"
);
break
;
case
'P'
:
c
=
(
isAM
)
?
(
""
+
"AM"
)
:
(
""
+
"PM"
);
break
;
case
'P'
:
c
=
(
isAM
)
?
(
""
+
"AM"
)
:
(
""
+
"PM"
);
break
;
case
'u'
:
c
=
""
+
(
d
.
getDay
()
+
1
);
break
;
case
'w'
:
c
=
""
+
d
.
getDay
();
break
;
case
'w'
:
c
=
""
+
d
.
getDay
();
break
;
}
}
r
.
push
(
c
);
r
.
push
(
c
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment