Skip to content

Commit 6f0b5d9

Browse files
committed
add ticklabeloverflow to cartesian axis and colorbar
1 parent e3b8709 commit 6f0b5d9

File tree

6 files changed

+35
-1
lines changed

6 files changed

+35
-1
lines changed

src/components/colorbar/attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ module.exports = overrideAll({
136136
tickvals: axesAttrs.tickvals,
137137
ticktext: axesAttrs.ticktext,
138138
ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}),
139+
ticklabeloverflow: extendFlat({}, axesAttrs.ticklabeloverflow, {dflt: 'allow'}),
139140
ticklabelposition: {
140141
valType: 'enumerated',
141142
values: [

src/components/colorbar/defaults.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) {
4242
coerce('bordercolor');
4343
coerce('borderwidth');
4444
coerce('bgcolor');
45+
4546
var ticklabelposition = coerce('ticklabelposition');
47+
coerce('ticklabeloverflow', ticklabelposition.indexOf('inside') !== -1 ? 'hide past domain' : 'hide past div');
4648

4749
handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear');
4850

src/components/colorbar/draw.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ function mockColorBarAxis(gd, opts, zrange) {
677677
tickcolor: opts.tickcolor,
678678
showticklabels: opts.showticklabels,
679679
ticklabelposition: opts.ticklabelposition,
680+
ticklabeloverflow: opts.ticklabeloverflow,
680681
tickfont: opts.tickfont,
681682
tickangle: opts.tickangle,
682683
tickformat: opts.tickformat,

src/plots/cartesian/axis_defaults.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
5656
}
5757
}
5858

59+
var ticklabelposition = '';
5960
if(!options.noTicklabelposition || axType === 'multicategory') {
60-
Lib.coerce(containerIn, containerOut, {
61+
ticklabelposition = Lib.coerce(containerIn, containerOut, {
6162
ticklabelposition: {
6263
valType: 'enumerated',
6364
dflt: 'outside',
@@ -75,6 +76,17 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
7576
}, 'ticklabelposition');
7677
}
7778

79+
if(!options.noTicklabeloverflow) {
80+
coerce('ticklabeloverflow',
81+
ticklabelposition.indexOf('inside') !== -1 ?
82+
'hide past domain' :
83+
axType === 'category' ||
84+
axType === 'multicategory' ?
85+
'allow' :
86+
'hide past div'
87+
);
88+
}
89+
7890
setConvert(containerOut, layoutOut);
7991

8092
var autorangeDflt = !containerOut.isValidRange(containerIn.range);

src/plots/cartesian/layout_attributes.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,23 @@ module.exports = {
493493
'so that the scales could match.'
494494
].join(' ')
495495
},
496+
ticklabeloverflow: {
497+
valType: 'enumerated',
498+
values: [
499+
'allow',
500+
'hide past div',
501+
'hide past domain',
502+
'push to div',
503+
'push to domain'
504+
],
505+
editType: 'calc',
506+
description: [
507+
'Determines whether or not the tick labels are drawn when overflown the div or domain.',
508+
'The default value for inside tick labels is *hide past domain*.',
509+
'Otherwise on *category* and *multicategory* axes the default is *allow*.',
510+
'In other cases the default is *hide past div*.'
511+
].join(' ')
512+
},
496513
mirror: {
497514
valType: 'enumerated',
498515
values: [true, 'ticks', false, 'all', 'allticks'],

src/plots/gl3d/layout/axis_defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
4444
noTickson: true,
4545
noTicklabelmode: true,
4646
noTicklabelposition: true,
47+
noTicklabeloverflow: true,
4748
bgColor: options.bgColor,
4849
calendar: options.calendar
4950
},

0 commit comments

Comments
 (0)