Skip to content

Commit 10e7fd0

Browse files
authored
Merge pull request #4695 from plotly/rangebreaks-avoid-tight-day-of-week-labels
Avoid tight daily labels on axes with rangebreaks when using "day of week" pattern
2 parents 7ad4317 + 1c09c84 commit 10e7fd0

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

src/plots/cartesian/axes.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -806,12 +806,7 @@ axes.autoTicks = function(ax, roughDTick) {
806806
roughDTick /= ONEAVGMONTH;
807807
ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24);
808808
} else if(roughX2 > ONEDAY) {
809-
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-
}
809+
ax.dtick = roundDTick(roughDTick, ONEDAY, ax._hasDayOfWeekBreaks ? [1, 7, 14] : roundDays);
815810

816811
// get week ticks on sunday
817812
// this will also move the base tick off 2000-01-01 if dtick is
Loading

test/image/mocks/axes_breaks-round-weekdays.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2073,8 +2073,8 @@
20732073
}
20742074
],
20752075
"range": [
2076-
"2015-11-07",
2077-
"2015-11-21"
2076+
"2015-11-06 12:00",
2077+
"2015-11-23 12:00"
20782078
]
20792079
},
20802080
"yaxis2": {

0 commit comments

Comments
 (0)