Skip to content

Commit cbfd1c8

Browse files
author
John Soklaski
committed
Move tickpadding coercion logic to tick_value_defaults
1 parent 4619b89 commit cbfd1c8

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/plots/cartesian/tick_defaults.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce,
5151
}
5252
}
5353

54-
//Only use tickpadding if tickmode is 'auto' and the user doesn't specify nticks
55-
if(containerOut.tickmode === 'auto' && containerOut.nticks === layoutAttributes.nticks.dflt) {
56-
coerce('tickpadding');
57-
} else {
58-
containerOut.tickpadding = layoutAttributes.tickpadding.dflt;
59-
}
60-
6154
if(axType !== 'category' && !options.noHover) coerce('hoverformat');
6255
};
6356

src/plots/cartesian/tick_value_defaults.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'use strict';
1111

1212
var isNumeric = require('fast-isnumeric');
13-
13+
var layoutAttributes = require('./layout_attributes');
1414

1515
module.exports = function handleTickValueDefaults(containerIn, containerOut, coerce, axType) {
1616
var tickmodeDefault = 'auto';
@@ -25,8 +25,18 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe
2525
tickmodeDefault = 'linear';
2626
}
2727
var tickmode = coerce('tickmode', tickmodeDefault);
28-
29-
if(tickmode === 'auto') coerce('nticks');
28+
29+
if(tickmode === 'auto') {
30+
var nticks = coerce('nticks');
31+
32+
//Only use tickpadding if tickmode is 'auto' and the user doesn't specify nticks
33+
if(nticks === layoutAttributes.nticks.dflt) {
34+
coerce('tickpadding');
35+
}
36+
else {
37+
containerOut.tickpadding = layoutAttributes.tickpadding.dflt;
38+
}
39+
}
3040
else if(tickmode === 'linear') {
3141
coerce('tick0');
3242
coerce('dtick');

0 commit comments

Comments
 (0)