File tree Expand file tree Collapse file tree 1 file changed +31
-22
lines changed Expand file tree Collapse file tree 1 file changed +31
-22
lines changed Original file line number Diff line number Diff line change @@ -16,36 +16,45 @@ class AxesSelector extends Component {
16
16
}
17
17
18
18
render ( ) {
19
- const { axesTargetHandler, axesTarget, localize : _ } = this . context ;
19
+ const {
20
+ axesTargetHandler,
21
+ axesTarget,
22
+ fullLayout,
23
+ localize : _ ,
24
+ } = this . context ;
20
25
const { axesOptions} = this . props ;
21
26
const maxOptions = axesOptions . length > 4 ; // eslint-disable-line
22
27
23
- if ( maxOptions ) {
24
- return (
25
- < Field { ...this . props } label = { _ ( 'Axis to Style' ) } >
26
- < Dropdown
27
- options = { axesOptions . map ( option => {
28
- if ( option . value !== 'allaxes' ) {
29
- return {
28
+ const multipleSublots =
29
+ fullLayout &&
30
+ fullLayout . _subplots &&
31
+ Object . values ( fullLayout . _subplots ) . some ( s => s . length > 1 ) ;
32
+
33
+ const options = multipleSublots
34
+ ? axesOptions . map (
35
+ option =>
36
+ option . value === 'allaxes'
37
+ ? option
38
+ : {
30
39
label : option . title ,
31
40
value : option . value ,
32
- } ;
33
- }
34
-
35
- return option ;
36
- } ) }
37
- value = { axesTarget }
38
- onChange = { axesTargetHandler }
39
- clearable = { false }
40
- />
41
- </ Field >
42
- ) ;
43
- }
41
+ }
42
+ )
43
+ : axesOptions ;
44
44
45
- return (
45
+ return maxOptions ? (
46
+ < Field { ...this . props } label = { _ ( 'Axis to Style' ) } >
47
+ < Dropdown
48
+ options = { options }
49
+ value = { axesTarget }
50
+ onChange = { axesTargetHandler }
51
+ clearable = { false }
52
+ />
53
+ </ Field >
54
+ ) : (
46
55
< Field { ...this . props } center >
47
56
< RadioBlocks
48
- options = { axesOptions }
57
+ options = { options }
49
58
activeOption = { axesTarget }
50
59
onOptionChange = { axesTargetHandler }
51
60
/>
You can’t perform that action at this time.
0 commit comments