Skip to content

Commit 2b9c90c

Browse files
committed
Replace ticklabelshiftx/y with ticklabelrunoff and ticklabelstandoff
And remove this feature from all non-cartesian traces. If other plots should be supported, this can be added and tested in separate PRs.
1 parent ecf4787 commit 2b9c90c

18 files changed

+32
-651
lines changed

src/components/colorbar/attributes.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ module.exports = overrideAll({
169169
'In other cases the default is *hide past div*.'
170170
].join(' ')
171171
}),
172+
172173
// ticklabelposition: not used directly, as values depend on orientation
173174
// left/right options are for x axes, and top/bottom options are for y axes
174175
ticklabelposition: {
@@ -187,8 +188,6 @@ module.exports = overrideAll({
187188
'top and bottom when `orientation` is *v*.'
188189
].join(' ')
189190
},
190-
ticklabelshiftx: axesAttrs.ticklabelshiftx,
191-
ticklabelshifty: axesAttrs.ticklabelshifty,
192191
ticklen: axesAttrs.ticklen,
193192
tickwidth: axesAttrs.tickwidth,
194193
tickcolor: axesAttrs.tickcolor,

src/components/colorbar/defaults.js

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) {
111111
var font = layout.font;
112112
var opts = {
113113
noAutotickangles: true,
114+
noTicklabelrunoffstandoff: true,
114115
outerTicks: false,
115116
font: font
116117
};

src/plots/cartesian/axes.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -2968,23 +2968,23 @@ axes.makeTransTickFn = function(ax) {
29682968

29692969
axes.makeTransTickLabelFn = function(ax) {
29702970
var uv = getTickLabelUV(ax);
2971-
var shiftx = ax.ticklabelshiftx || 0;
2972-
var shifty = ax.ticklabelshifty || 0;
2971+
var runoff = ax.ticklabelrunoff || 0;
2972+
var standoff = ax.ticklabelstandoff || 0;
29732973

29742974
var u = uv[0];
29752975
var v = uv[1];
29762976

29772977
return ax._id.charAt(0) === 'x' ?
29782978
function(d) {
29792979
return strTranslate(
2980-
u + ax._offset + ax.l2p(getPosX(d)) + shiftx,
2981-
v + shifty
2980+
u + ax._offset + ax.l2p(getPosX(d)) + standoff,
2981+
v + runoff
29822982
);
29832983
} :
29842984
function(d) {
29852985
return strTranslate(
2986-
v + shiftx,
2987-
u + ax._offset + ax.l2p(getPosX(d)) + shifty
2986+
v + runoff,
2987+
u + ax._offset + ax.l2p(getPosX(d)) + standoff
29882988
);
29892989
};
29902990
};

src/plots/cartesian/layout_attributes.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -698,20 +698,20 @@ module.exports = {
698698
'In other cases the default is *hide past div*.'
699699
].join(' ')
700700
},
701-
ticklabelshiftx: {
701+
ticklabelrunoff: {
702702
valType: 'integer',
703703
dflt: 0,
704704
editType: 'ticks',
705705
description: [
706-
'Horizontally shifts the tick labels by the specified number of pixels.'
706+
'Shifts the tick labels by the specified number of pixels in parallel to the axis.'
707707
].join(' ')
708708
},
709-
ticklabelshifty: {
709+
ticklabelstandoff: {
710710
valType: 'integer',
711711
dflt: 0,
712712
editType: 'ticks',
713713
description: [
714-
'Vertically shifts the tick labels by the specified number of pixels.'
714+
'Shifts the tick labels by the specified number of pixels orthogonally to the axis.'
715715
].join(' ')
716716
},
717717
mirror: {

src/plots/cartesian/tick_label_defaults.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
1616

1717
var showTickLabels = coerce('showticklabels');
1818
if(showTickLabels) {
19-
coerce('ticklabelshiftx');
20-
coerce('ticklabelshifty');
19+
if(!options.noTicklabelrunoffstandoff) {
20+
coerce('ticklabelrunoff');
21+
coerce('ticklabelstandoff');
22+
}
2123
var font = options.font || {};
2224
var contColor = containerOut.color;
2325
var position = containerOut.ticklabelposition || '';

src/plots/gl3d/layout/axis_attributes.js

-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ module.exports = overrideAll({
9393
ticks: axesAttrs.ticks,
9494
mirror: axesAttrs.mirror,
9595
ticklen: axesAttrs.ticklen,
96-
ticklabelshiftx: axesAttrs.ticklabelshiftx,
97-
ticklabelshifty: axesAttrs.ticklabelshifty,
9896
tickwidth: axesAttrs.tickwidth,
9997
tickcolor: axesAttrs.tickcolor,
10098
showticklabels: axesAttrs.showticklabels,

src/plots/gl3d/layout/axis_defaults.js

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
4444
noAutotickangles: true,
4545
noTickson: true,
4646
noTicklabelmode: true,
47+
noTicklabelrunoffstandoff: true,
4748
noTicklabelstep: true,
4849
noTicklabelposition: true,
4950
noTicklabeloverflow: true,

src/plots/polar/layout_attributes.js

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ var axisTickAttrs = overrideAll({
3333
ticklen: axesAttrs.ticklen,
3434
tickwidth: axesAttrs.tickwidth,
3535
tickcolor: axesAttrs.tickcolor,
36-
ticklabelshiftx: axesAttrs.ticklabelshiftx,
37-
ticklabelshifty: axesAttrs.ticklabelshifty,
3836
ticklabelstep: axesAttrs.ticklabelstep,
3937
showticklabels: axesAttrs.showticklabels,
4038
labelalias: axesAttrs.labelalias,

src/plots/polar/layout_defaults.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ function handleDefaults(contIn, contOut, coerce, opts) {
186186
size: dfltFontSize,
187187
family: dfltFontFamily
188188
},
189-
noAutotickangles: axName === 'angularaxis'
189+
noAutotickangles: axName === 'angularaxis',
190+
noTicklabelrunoffstandoff: true
190191
});
191192

192193
handleTickMarkDefaults(axIn, axOut, coerceAxis, {outerTicks: true});

src/plots/smith/layout_attributes.js

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ var axisLineGridAttr = overrideAll({
1818
}, 'plot', 'from-root');
1919

2020
var axisTickAttrs = overrideAll({
21-
ticklabelshiftx: axesAttrs.ticklabelshiftx,
22-
ticklabelshifty: axesAttrs.ticklabelshifty,
2321
ticklen: axesAttrs.ticklen,
2422
tickwidth: extendFlat({}, axesAttrs.tickwidth, {dflt: 2}),
2523
tickcolor: axesAttrs.tickcolor,

src/plots/smith/layout_defaults.js

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
9090

9191
handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type, {
9292
noAutotickangles: true,
93+
noTicklabelrunoffstandoff: true,
9394
noTicklabelstep: true,
9495
noAng: !isRealAxis,
9596
noExp: true,

src/plots/ternary/layout_attributes.js

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ var ternaryAxesAttrs = {
2525
ticklen: axesAttrs.ticklen,
2626
tickwidth: axesAttrs.tickwidth,
2727
tickcolor: axesAttrs.tickcolor,
28-
ticklabelshiftx: axesAttrs.ticklabelshiftx,
29-
ticklabelshifty: axesAttrs.ticklabelshifty,
3028
ticklabelstep: axesAttrs.ticklabelstep,
3129
showticklabels: axesAttrs.showticklabels,
3230
labelalias: axesAttrs.labelalias,

src/plots/ternary/layout_defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function handleAxisDefaults(containerIn, containerOut, options, ternaryLayoutOut
9191

9292
handleTickValueDefaults(containerIn, containerOut, coerce, 'linear');
9393
handlePrefixSuffixDefaults(containerIn, containerOut, coerce, 'linear');
94-
handleTickLabelDefaults(containerIn, containerOut, coerce, 'linear', { noAutotickangles: true });
94+
handleTickLabelDefaults(containerIn, containerOut, coerce, 'linear', { noAutotickangles: true, noTicklabelrunoffstandoff: true });
9595
handleTickMarkDefaults(containerIn, containerOut, coerce,
9696
{ outerTicks: true });
9797

src/traces/carpet/ab_defaults.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) {
3131

3232
var defaultOptions = {
3333
noAutotickangles: true,
34+
noTicklabelrunoffstandoff: true,
3435
noTicklabelstep: true,
3536
tickfont: 'x',
3637
id: axLetter + 'axis',

src/traces/carpet/axis_attributes.js

-16
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,6 @@ module.exports = {
157157
'Has an effect only if `tickmode` is set to *auto*.'
158158
].join(' ')
159159
},
160-
ticklabelshiftx: {
161-
valType: 'integer',
162-
dflt: 0,
163-
editType: 'calc',
164-
description: [
165-
'Horizontally shifts the tick labels by the specified number of pixels.'
166-
].join(' ')
167-
},
168-
ticklabelshifty: {
169-
valType: 'integer',
170-
dflt: 0,
171-
editType: 'calc',
172-
description: [
173-
'Vertically shifts the tick labels by the specified number of pixels.'
174-
].join(' ')
175-
},
176160
tickvals: {
177161
valType: 'data_array',
178162
editType: 'calc',

src/traces/indicator/attributes.js

-2
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,6 @@ module.exports = {
317317
ticklen: axesAttrs.ticklen,
318318
tickwidth: axesAttrs.tickwidth,
319319
tickcolor: axesAttrs.tickcolor,
320-
ticklabelshiftx: axesAttrs.ticklabelshiftx,
321-
ticklabelshifty: axesAttrs.ticklabelshifty,
322320
ticklabelstep: axesAttrs.ticklabelstep,
323321
showticklabels: axesAttrs.showticklabels,
324322
labelalias: axesAttrs.labelalias,

src/traces/indicator/defaults.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
132132
var opts = {
133133
font: layout.font,
134134
noAutotickangles: true,
135-
outerTicks: true
135+
outerTicks: true,
136+
noTicklabelrunoffstandoff: true
136137
};
137138
handleTickValueDefaults(axisIn, axisOut, coerceGaugeAxis, 'linear');
138139
handlePrefixSuffixDefaults(axisIn, axisOut, coerceGaugeAxis, 'linear', opts);

0 commit comments

Comments
 (0)