Skip to content

Commit 8ea077e

Browse files
author
John Soklaski
committed
Move tickpadding coercion logic to tick_value_defaults
1 parent 95257b6 commit 8ea077e

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/plots/cartesian/tick_label_defaults.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
4747
}
4848
}
4949

50-
//Only use tickpadding if tickmode is 'auto' and the user doesn't specify nticks
51-
if(containerOut.tickmode === 'auto' && containerOut.nticks === layoutAttributes.nticks.dflt) {
52-
coerce('tickpadding');
53-
} else {
54-
containerOut.tickpadding = layoutAttributes.tickpadding.dflt;
55-
}
56-
5750
if(axType !== 'category' && !options.noHover) coerce('hoverformat');
5851
};
5952

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)