Skip to content

Commit 795350a

Browse files
Update plot-schema without tickmode for minor axes
1 parent fd78e8d commit 795350a

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

src/plots/cartesian/layout_attributes.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ var constants = require('./constants');
1212
var HOUR = constants.HOUR_PATTERN;
1313
var DAY_OF_WEEK = constants.WEEKDAY_PATTERN;
1414

15-
var tickmode = {
16-
valType: 'enumerated',
17-
values: ['auto', 'linear', 'array', 'sync'],
18-
editType: 'ticks',
19-
impliedEdits: {tick0: undefined, dtick: undefined},
20-
description: [
15+
function makeTickmode(minor) {
16+
var values = ['auto', 'linear', 'array', 'sync'];
17+
var description = [
2118
'Sets the tick mode for this axis.',
2219
'If *auto*, the number of ticks is set via `nticks`.',
2320
'If *linear*, the placement of the ticks is determined by',
@@ -28,7 +25,20 @@ var tickmode = {
2825
'(*array* is the default value if `tickvals` is provided).',
2926
'If *sync*, the number of ticks will sync with the overlayed axis',
3027
'set by `overlaying` property.'
31-
].join(' ')
28+
];
29+
30+
if(minor) {
31+
values = values.slice(0, -1);
32+
description = description.slice(0, -2);
33+
}
34+
35+
return {
36+
valType: 'enumerated',
37+
values: values,
38+
editType: 'ticks',
39+
impliedEdits: {tick0: undefined, dtick: undefined},
40+
description: description.join(' ')
41+
}
3242
};
3343

3444
function makeNticks(minor) {
@@ -506,7 +516,7 @@ module.exports = {
506516
}),
507517

508518
// ticks
509-
tickmode: tickmode,
519+
tickmode: makeTickmode(),
510520
nticks: makeNticks(),
511521
tick0: tick0,
512522
dtick: dtick,
@@ -949,19 +959,7 @@ module.exports = {
949959
},
950960

951961
minor: {
952-
tickmode: extendFlat({}, axesAttrs.tickmode, {
953-
values: ['auto', 'linear', 'array'],
954-
description: [
955-
'Sets the tick mode for this axis.',
956-
'If *auto*, the number of ticks is set via `nticks`.',
957-
'If *linear*, the placement of the ticks is determined by',
958-
'a starting position `tick0` and a tick step `dtick`',
959-
'(*linear* is the default value if `tick0` and `dtick` are provided).',
960-
'If *array*, the placement of the ticks is set via `tickvals`',
961-
'and the tick text is `ticktext`.',
962-
'(*array* is the default value if `tickvals` is provided).'
963-
].join(' ')
964-
}),
962+
tickmode: makeTickmode('minor'),
965963
nticks: makeNticks('minor'),
966964
tick0: tick0,
967965
dtick: dtick,

test/plot-schema.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10278,15 +10278,14 @@
1027810278
"valType": "number"
1027910279
},
1028010280
"tickmode": {
10281-
"description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided). If *sync*, the number of ticks will sync with the overlayed axis set by `overlaying` property.",
10281+
"description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided).",
1028210282
"editType": "ticks",
1028310283
"impliedEdits": {},
1028410284
"valType": "enumerated",
1028510285
"values": [
1028610286
"auto",
1028710287
"linear",
10288-
"array",
10289-
"sync"
10288+
"array"
1029010289
]
1029110290
},
1029210291
"ticks": {
@@ -11537,15 +11536,14 @@
1153711536
"valType": "number"
1153811537
},
1153911538
"tickmode": {
11540-
"description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided). If *sync*, the number of ticks will sync with the overlayed axis set by `overlaying` property.",
11539+
"description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided).",
1154111540
"editType": "ticks",
1154211541
"impliedEdits": {},
1154311542
"valType": "enumerated",
1154411543
"values": [
1154511544
"auto",
1154611545
"linear",
11547-
"array",
11548-
"sync"
11546+
"array"
1154911547
]
1155011548
},
1155111549
"ticks": {

0 commit comments

Comments
 (0)