Skip to content

Commit 9314593

Browse files
committed
add labelalias to various ax objects
1 parent 70c49ce commit 9314593

File tree

11 files changed

+334
-0
lines changed

11 files changed

+334
-0
lines changed

src/components/colorbar/attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ module.exports = overrideAll({
168168
tickcolor: axesAttrs.tickcolor,
169169
ticklabelstep: axesAttrs.ticklabelstep,
170170
showticklabels: axesAttrs.showticklabels,
171+
labelalias: axesAttrs.labelalias,
171172
tickfont: fontAttrs({
172173
description: 'Sets the color bar\'s tick label font'
173174
}),

src/components/colorbar/draw.js

+1
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,7 @@ function mockColorBarAxis(gd, opts, zrange) {
931931
tickwidth: opts.tickwidth,
932932
tickcolor: opts.tickcolor,
933933
showticklabels: opts.showticklabels,
934+
labelalias: opts.labelalias,
934935
ticklabelposition: opts.ticklabelposition,
935936
ticklabeloverflow: opts.ticklabeloverflow,
936937
ticklabelstep: opts.ticklabelstep,

src/plots/cartesian/layout_attributes.js

+11
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,17 @@ module.exports = {
633633
editType: 'ticks',
634634
description: 'Determines whether or not the tick labels are drawn.'
635635
},
636+
labelalias: {
637+
valType: 'any',
638+
dflt: false,
639+
editType: 'ticks',
640+
description: [
641+
'Determines the alias for certain labels for ticks and hover.',
642+
'For example using {US: \'USA\', CA: \'Canada\'} maps US to USA',
643+
'and CA to Canada if tick or hover labels match US or Canada i.e.',
644+
'before adding prefix and suffix to labels.'
645+
].join(' ')
646+
},
636647
automargin: {
637648
valType: 'flaglist',
638649
flags: ['height', 'width', 'left', 'right', 'top', 'bottom'],

src/plots/cartesian/tick_label_defaults.js

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ var handleArrayContainerDefaults = require('../array_container_defaults');
88

99
module.exports = function handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options) {
1010
if(!options) options = {};
11+
12+
coerce('labelalias');
13+
1114
var showAttrDflt = getShowAttrDflt(containerIn);
1215

1316
var showTickLabels = coerce('showticklabels');

src/plots/gl3d/layout/axis_attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ module.exports = overrideAll({
8686
tickwidth: axesAttrs.tickwidth,
8787
tickcolor: axesAttrs.tickcolor,
8888
showticklabels: axesAttrs.showticklabels,
89+
labelalias: axesAttrs.labelalias,
8990
tickfont: axesAttrs.tickfont,
9091
tickangle: axesAttrs.tickangle,
9192
tickprefix: axesAttrs.tickprefix,

src/plots/polar/layout_attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var axisTickAttrs = overrideAll({
3535
tickcolor: axesAttrs.tickcolor,
3636
ticklabelstep: axesAttrs.ticklabelstep,
3737
showticklabels: axesAttrs.showticklabels,
38+
labelalias: axesAttrs.labelalias,
3839
showtickprefix: axesAttrs.showtickprefix,
3940
tickprefix: axesAttrs.tickprefix,
4041
showticksuffix: axesAttrs.showticksuffix,

src/plots/smith/layout_attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var axisTickAttrs = overrideAll({
2222
tickwidth: extendFlat({}, axesAttrs.tickwidth, {dflt: 2}),
2323
tickcolor: axesAttrs.tickcolor,
2424
showticklabels: axesAttrs.showticklabels,
25+
labelalias: axesAttrs.labelalias,
2526
showtickprefix: axesAttrs.showtickprefix,
2627
tickprefix: axesAttrs.tickprefix,
2728
showticksuffix: axesAttrs.showticksuffix,

src/plots/ternary/layout_attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var ternaryAxesAttrs = {
2727
tickcolor: axesAttrs.tickcolor,
2828
ticklabelstep: axesAttrs.ticklabelstep,
2929
showticklabels: axesAttrs.showticklabels,
30+
labelalias: axesAttrs.labelalias,
3031
showtickprefix: axesAttrs.showtickprefix,
3132
tickprefix: axesAttrs.tickprefix,
3233
showticksuffix: axesAttrs.showticksuffix,

src/traces/carpet/axis_attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ module.exports = {
185185
'the high side, both, or neither side of the axis.'
186186
].join(' ')
187187
},
188+
labelalias: extendFlat({}, axesAttrs.labelalias, {editType: 'calc'}),
188189
tickfont: fontAttrs({
189190
editType: 'calc',
190191
description: 'Sets the tick font.'

src/traces/indicator/attributes.js

+1
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ module.exports = {
319319
tickcolor: axesAttrs.tickcolor,
320320
ticklabelstep: axesAttrs.ticklabelstep,
321321
showticklabels: axesAttrs.showticklabels,
322+
labelalias: axesAttrs.labelalias,
322323
tickfont: fontAttrs({
323324
description: 'Sets the color bar\'s tick label font'
324325
}),

test/plot-schema.json

+312
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)