-
-
Couldn't load subscription status.
- Fork 1.9k
handle various time formats in ticklabelmode period #5065
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
e220b65
9424347
cd53a6a
ca993b9
4a87806
c3e5181
854c8c7
7b9391f
e265f0d
40c6df6
9399031
f0f078a
90ee834
1c94ba9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -700,18 +700,44 @@ axes.calcTicks = function calcTicks(ax, opts) { | |||||||||
| }; | ||||||||||
|
|
||||||||||
| if( | ||||||||||
| !_has('%f') && | ||||||||||
| !_has('%H') && | ||||||||||
| !_has('%I') && | ||||||||||
| !_has('%L') && | ||||||||||
| !_has('%Q') && | ||||||||||
| !_has('%S') && | ||||||||||
| !_has('%s') && | ||||||||||
| !_has('%X') | ||||||||||
| !_has('%f') && // microseconds as a decimal number [000000, 999999] | ||||||||||
| !_has('%L') && // milliseconds as a decimal number [000, 999] | ||||||||||
| !_has('%Q') && // milliseconds since UNIX epoch | ||||||||||
| !_has('%s') && // seconds since UNIX epoch | ||||||||||
| !_has('%S') && // second as a decimal number [00,61] | ||||||||||
| !_has('%M') && // minute as a decimal number [00,59] | ||||||||||
| !_has('%H') && // hour (24-hour clock) as a decimal number [00,23] | ||||||||||
| !_has('%I') && // hour (12-hour clock) as a decimal number [01,12] | ||||||||||
| !_has('%p') && // either AM or PM | ||||||||||
| !_has('%X') // the locale’s time, such as %-I:%M:%S %p | ||||||||||
| ) { | ||||||||||
| if(_has('%x') || _has('%d') || _has('%e') || _has('%j')) definedDelta = ONEDAY; | ||||||||||
| else if(_has('%B') || _has('%b') || _has('%m')) definedDelta = ONEAVGMONTH; | ||||||||||
| else if(_has('%Y') || _has('%y')) definedDelta = ONEAVGYEAR; | ||||||||||
| if( | ||||||||||
| _has('%d') || // zero-padded day of the month as a decimal number [01,31] | ||||||||||
| _has('%e') || // space-padded day of the month as a decimal number [ 1,31] | ||||||||||
| _has('%j') || // day of the year as a decimal number [001,366] | ||||||||||
| _has('%u') || // Monday-based (ISO 8601) weekday as a decimal number [1,7] | ||||||||||
| _has('%w') || // Sunday-based weekday as a decimal number [0,6] | ||||||||||
| _has('%x') // the locale’s date, such as %-m/%-d/%Y | ||||||||||
| ) definedDelta = ONEDAY; | ||||||||||
| else if( | ||||||||||
| _has('%A') || // full weekday name | ||||||||||
| _has('%a') || // abbreviated weekday name | ||||||||||
| _has('%U') || // Sunday-based week of the year as a decimal number [00,53] | ||||||||||
|
||||||||||
| // get week ticks on sunday | |
| // this will also move the base tick off 2000-01-01 if dtick is | |
| // 2 or 3 days... but that's a weird enough case that we'll ignore it. | |
| ax.tick0 = Lib.dateTick0(ax.calendar, true); |
I guess with a
tickformat including %W we should add a day to the result there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we should, yes :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also %V starts on Mondays.
Side note: Am I missing something or are %u (new week on Monday) and %w (new week on Sunday) backward compared to %U (new week on Sunday) and %W (new week on Monday)? I mean, not an error here, nor in D3, this dates back to strftime from C so has probably been around for 40 years...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't weekdays go in the
ONEDAYbucket?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 9424347.