@@ -52,7 +52,11 @@ class TraceSelector extends Component {
52
52
'tonext' ,
53
53
] ;
54
54
}
55
-
55
+ this . setTraceDefaults (
56
+ props . container ,
57
+ props . fullContainer ,
58
+ props . updateContainer
59
+ ) ;
56
60
this . setLocals ( props , context ) ;
57
61
}
58
62
@@ -64,17 +68,30 @@ class TraceSelector extends Component {
64
68
} else {
65
69
this . traceOptions = [ { label : 'Scatter' , value : 'scatter' } ] ;
66
70
}
71
+ this . fullValue = plotlyTraceToCustomTrace ( props . container ) ;
72
+ }
67
73
68
- this . fullValue = plotlyTraceToCustomTrace ( props . fullContainer ) ;
74
+ setTraceDefaults ( container , fullContainer , updateContainer ) {
75
+ if (
76
+ ( container . type === 'scatter' && ! container . mode ) ||
77
+ ( ! container . type && fullContainer . type === 'scatter' )
78
+ ) {
79
+ updateContainer ( {
80
+ type : 'scatter' ,
81
+ mode : fullContainer . mode || 'markers' ,
82
+ fill : fullContainer . fill || container . fill ,
83
+ } ) ;
84
+ }
69
85
}
70
86
71
87
componentWillReceiveProps ( nextProps , nextContext ) {
88
+ const { container, fullContainer, updateContainer} = nextProps ;
89
+ this . setTraceDefaults ( container , fullContainer , updateContainer ) ;
72
90
this . setLocals ( nextProps , nextContext ) ;
73
91
}
74
92
75
93
updatePlot ( value ) {
76
94
const update = customTraceToPlotlyTrace ( value ) ;
77
-
78
95
if ( this . props . updateContainer ) {
79
96
this . props . updateContainer ( update ) ;
80
97
}
@@ -97,6 +114,7 @@ TraceSelector.contextTypes = {
97
114
98
115
TraceSelector . propTypes = {
99
116
getValObject : PropTypes . func ,
117
+ container : PropTypes . object . isRequired ,
100
118
fullContainer : PropTypes . object . isRequired ,
101
119
fullValue : PropTypes . any . isRequired ,
102
120
updateContainer : PropTypes . func ,
0 commit comments