Skip to content

Commit 3daa0a5

Browse files
committed
avoid missing gridlines on rangebreaks with pattern day of week
- round 2 days to 1 day - round 3 days to 7 days
1 parent 60425d2 commit 3daa0a5

File tree

4 files changed

+2143
-0
lines changed

4 files changed

+2143
-0
lines changed

src/plots/cartesian/axes.js

+6
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,12 @@ axes.autoTicks = function(ax, roughDTick) {
807807
ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24);
808808
} else if(roughX2 > ONEDAY) {
809809
ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays);
810+
811+
if(ax._hasDayOfWeekBreaks) {
812+
if(ax.dtick === 2 * ONEDAY) ax.dtick = ONEDAY;
813+
else if(ax.dtick === 3 * ONEDAY) ax.dtick = 7 * ONEDAY;
814+
}
815+
810816
// get week ticks on sunday
811817
// this will also move the base tick off 2000-01-01 if dtick is
812818
// 2 or 3 days... but that's a weird enough case that we'll ignore it.

src/plots/cartesian/axis_defaults.js

+7
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
135135
if(!containerOut.rangebreaks.length) {
136136
delete containerOut.rangebreaks;
137137
} else {
138+
for(var k = 0; k < containerOut.rangebreaks.length; k++) {
139+
if(containerOut.rangebreaks[k].pattern === DAY_OF_WEEK) {
140+
containerOut._hasDayOfWeekBreaks = true;
141+
break;
142+
}
143+
}
144+
138145
setConvert(containerOut, layoutOut);
139146

140147
if(layoutOut._has('scattergl') || layoutOut._has('splom')) {
Loading

0 commit comments

Comments
 (0)