File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -122,9 +122,7 @@ class EditorControls extends Component {
122122 // can't use default prop because plotly.js mutates it:
123123 // https://github.com/plotly/react-chart-editor/issues/509
124124 graphDiv . data . push (
125- this . props . useAsDefaultTrace
126- ? this . props . useAsDefaultTrace
127- : { type : 'scatter' , mode : 'markers' }
125+ this . props . makeDefaultTrace ( this . props . useAsDefaultTrace )
128126 ) ;
129127
130128 if ( this . props . afterAddTrace ) {
@@ -307,11 +305,18 @@ EditorControls.propTypes = {
307305 showFieldTooltips : PropTypes . bool ,
308306 traceTypesConfig : PropTypes . object ,
309307 useAsDefaultTrace : PropTypes . object ,
308+ makeDefaultTrace : PropTypes . func ,
310309} ;
311310
312311EditorControls . defaultProps = {
313312 showFieldTooltips : false ,
314313 locale : 'en' ,
314+ makeDefaultTrace : suppliedDefault => {
315+ if ( suppliedDefault ) {
316+ return suppliedDefault ;
317+ }
318+ return { type : 'scatter' , mode : 'markers' } ;
319+ } ,
315320 traceTypesConfig : {
316321 categories : _ => categoryLayout ( _ ) ,
317322 traces : _ => traceTypes ( _ ) ,
You can’t perform that action at this time.
0 commit comments