Skip to content
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

Avoid tight daily labels on axes with rangebreaks when using "day of week" pattern #4695

Merged
merged 7 commits into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,12 +806,7 @@ axes.autoTicks = function(ax, roughDTick) {
roughDTick /= ONEAVGMONTH;
ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24);
} else if(roughX2 > ONEDAY) {
ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays);

if(ax._hasDayOfWeekBreaks) {
if(ax.dtick === 2 * ONEDAY) ax.dtick = ONEDAY;
else if(ax.dtick === 3 * ONEDAY) ax.dtick = 7 * ONEDAY;
}
ax.dtick = roundDTick(roughDTick, ONEDAY, ax._hasDayOfWeekBreaks ? [1, 7, 14] : roundDays);

// get week ticks on sunday
// this will also move the base tick off 2000-01-01 if dtick is
Expand Down
Binary file modified test/image/baselines/axes_breaks-round-weekdays.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions test/image/mocks/axes_breaks-round-weekdays.json
Original file line number Diff line number Diff line change
Expand Up @@ -2073,8 +2073,8 @@
}
],
"range": [
"2015-11-07",
"2015-11-21"
"2015-11-06 12:00",
"2015-11-23 12:00"
]
},
"yaxis2": {
Expand Down