@@ -34,10 +34,12 @@ function deepCopyPublic(value) {
34
34
/*
35
35
* Test that we can connectLayoutToPlot(connectAxesToLayout(Panel))
36
36
*/
37
- function setMultiValuedContainer ( intoObj , fromObj , key , searchArrays ) {
37
+ function setMultiValuedContainer ( intoObj , fromObj , key , config = { } ) {
38
38
var intoVal = intoObj [ key ] ,
39
39
fromVal = fromObj [ key ] ;
40
40
41
+ var searchArrays = config . searchArrays ;
42
+
41
43
// don't merge private attrs
42
44
if (
43
45
( typeof key === 'string' && key . charAt ( 0 ) === '_' ) ||
@@ -126,18 +128,22 @@ export default function connectAxesToLayout(WrappedComponent) {
126
128
setLocals ( nextProps , nextState , nextContext ) {
127
129
const { plotly, graphDiv, container, fullContainer} = nextContext ;
128
130
const { axesTarget} = nextState ;
129
- this . axes = plotly . Axes . list ( graphDiv ) ;
131
+ if ( plotly ) {
132
+ this . axes = plotly . Axes . list ( graphDiv ) ;
133
+ } else {
134
+ this . axes = [ ] ;
135
+ }
130
136
this . axesOptions = computeAxesOptions ( fullContainer , this . axes ) ;
131
137
132
138
if ( axesTarget === 'allaxes' ) {
133
139
const multiValuedContainer = deepCopyPublic ( this . axes [ 0 ] ) ;
134
- this . axes
135
- . slice ( 1 )
136
- . forEach ( ax =>
137
- Object . keys ( ax ) . forEach ( key =>
138
- setMultiValuedContainer ( multiValuedContainer , ax , key )
139
- )
140
- ) ;
140
+ this . axes . slice ( 1 ) . forEach ( ax =>
141
+ Object . keys ( ax ) . forEach ( key =>
142
+ setMultiValuedContainer ( multiValuedContainer , ax , key , {
143
+ searchArrays : true ,
144
+ } )
145
+ )
146
+ ) ;
141
147
this . fullContainer = multiValuedContainer ;
142
148
this . defaultContainer = this . axes [ 0 ] ;
143
149
// what should this be set to? Probably doesn't matter.
@@ -214,8 +220,8 @@ export default function connectAxesToLayout(WrappedComponent) {
214
220
container : PropTypes . object . isRequired ,
215
221
fullContainer : PropTypes . object . isRequired ,
216
222
graphDiv : PropTypes . object . isRequired ,
217
- plotly : PropTypes . object . isRequired ,
218
- updateContainer : PropTypes . func . isRequired ,
223
+ plotly : PropTypes . object ,
224
+ updateContainer : PropTypes . func ,
219
225
} ;
220
226
221
227
AxesConnectedComponent . childContextTypes = {
0 commit comments