Skip to content

Commit

Permalink
Merge pull request #4688 from plotly/rangebreaks-missing-gridlines
Browse files Browse the repository at this point in the history
Avoid missing gridlines on axis with rangebreaks using "day of week" pattern
  • Loading branch information
archmoj authored Mar 25, 2020
2 parents 60425d2 + 3daa0a5 commit 7c67896
Show file tree
Hide file tree
Showing 4 changed files with 2,143 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,12 @@ axes.autoTicks = function(ax, roughDTick) {
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;
}

// 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.
Expand Down
7 changes: 7 additions & 0 deletions src/plots/cartesian/axis_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
if(!containerOut.rangebreaks.length) {
delete containerOut.rangebreaks;
} else {
for(var k = 0; k < containerOut.rangebreaks.length; k++) {
if(containerOut.rangebreaks[k].pattern === DAY_OF_WEEK) {
containerOut._hasDayOfWeekBreaks = true;
break;
}
}

setConvert(containerOut, layoutOut);

if(layoutOut._has('scattergl') || layoutOut._has('splom')) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7c67896

Please sign in to comment.