-
-
Notifications
You must be signed in to change notification settings - 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] | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where in the code do you differentiate between the start point of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. This is just the fall back to set the distance between labels. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, but then how can we differentiate between sunday- and monday-starting weeks? via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point - it's a bit different from the point of this PR, but here's where the automatic plotly.js/src/plots/cartesian/axes.js Lines 876 to 879 in cfc8c2c
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Also Side note: Am I missing something or are |
||||||||||
_has('%V') || // ISO 8601 week of the year as a decimal number [01, 53] | ||||||||||
_has('%W') // Monday-based week of the year as a decimal number [00,53] | ||||||||||
) definedDelta = ONEDAY * 7; | ||||||||||
else if( | ||||||||||
_has('%B') || // full month name | ||||||||||
_has('%b') || // abbreviated month name | ||||||||||
_has('%m') // month as a decimal number [01,12] | ||||||||||
) definedDelta = ONEAVGMONTH; | ||||||||||
else if( | ||||||||||
_has('%q') // quarter of the year as a decimal number [1,4] | ||||||||||
) definedDelta = ONEAVGYEAR / 4; | ||||||||||
else if( | ||||||||||
_has('%Y') || // year with century as a decimal number, such as 1999 | ||||||||||
_has('%y') // year without century as a decimal number [00,99] | ||||||||||
) definedDelta = ONEAVGYEAR; | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
|
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
ONEDAY
bucket?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.