Skip to content

Commit 1c09c84

Browse files
committed
simply apply 1, 7, 14 rounding for week breaks and dont touch dtick results
1 parent 7a2ca15 commit 1c09c84

File tree

4 files changed

+2
-5
lines changed

4 files changed

+2
-5
lines changed

src/constants/numerical.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ module.exports = {
3333
*/
3434
ONEAVGYEAR: 31557600000, // 365.25 days
3535
ONEAVGMONTH: 2629800000, // 1/12 of ONEAVGYEAR
36-
ONEWEEK: 604800000,
3736
ONEDAY: 86400000,
3837
ONEHOUR: 3600000,
3938
ONEMIN: 60000,

src/plots/cartesian/axes.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ var cleanTicks = require('./clean_ticks');
2525
var constants = require('../../constants/numerical');
2626
var ONEAVGYEAR = constants.ONEAVGYEAR;
2727
var ONEAVGMONTH = constants.ONEAVGMONTH;
28-
var ONEWEEK = constants.ONEWEEK;
2928
var ONEDAY = constants.ONEDAY;
3029
var ONEHOUR = constants.ONEHOUR;
3130
var ONEMIN = constants.ONEMIN;
@@ -514,7 +513,7 @@ axes.prepTicks = function(ax) {
514513
minPx = ax.tickfont ? (ax.tickfont.size || 12) * 1.2 : 15;
515514
nt = ax._length / minPx;
516515
} else {
517-
minPx = ax._hasDayOfWeekBreaks ? 40 : ax._id.charAt(0) === 'y' ? 40 : 80;
516+
minPx = ax._id.charAt(0) === 'y' ? 40 : 80;
518517
nt = Lib.constrain(ax._length / minPx, 4, 9) + 1;
519518
}
520519

@@ -807,8 +806,7 @@ axes.autoTicks = function(ax, roughDTick) {
807806
roughDTick /= ONEAVGMONTH;
808807
ax.dtick = 'M' + roundDTick(roughDTick, 1, roundBase24);
809808
} else if(roughX2 > ONEDAY) {
810-
ax.dtick = roundDTick(roughDTick, ONEDAY, roundDays);
811-
if(ax._hasDayOfWeekBreaks && ax.dtick < ONEWEEK) ax.dtick = ONEWEEK;
809+
ax.dtick = roundDTick(roughDTick, ONEDAY, ax._hasDayOfWeekBreaks ? [1, 7, 14] : roundDays);
812810

813811
// get week ticks on sunday
814812
// this will also move the base tick off 2000-01-01 if dtick is
-6.3 KB
Loading
Loading

0 commit comments

Comments
 (0)