@@ -189,15 +189,19 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
189
189
var counterAxes = { x : getCounterAxes ( 'x' ) , y : getCounterAxes ( 'y' ) } ;
190
190
// list of all x AND y axis ids
191
191
var allAxisIds = counterAxes . x . concat ( counterAxes . y ) ;
192
- // list of axis ids that axes in axNames have a reference to,
192
+ // lookup and list of axis ids that axes in axNames have a reference to,
193
193
// even though they are missing from allAxisIds
194
+ var missingMatchedAxisIdsLookup = { } ;
194
195
var missingMatchedAxisIds = [ ] ;
195
196
196
- // fill in 'missing' axis list when an axis is set to match an axis
197
- // not part of the allAxisIds list
198
- function addMissingMatchedAxis ( matchesIn ) {
197
+ // fill in 'missing' axis lookup when an axis is set to match an axis
198
+ // not part of the allAxisIds list, save axis type so that we can propagate
199
+ // it to the missing axes
200
+ function addMissingMatchedAxis ( ) {
201
+ var matchesIn = axLayoutIn . matches ;
199
202
if ( AX_ID_PATTERN . test ( matchesIn ) && allAxisIds . indexOf ( matchesIn ) === - 1 ) {
200
- Lib . pushUnique ( missingMatchedAxisIds , matchesIn ) ;
203
+ missingMatchedAxisIdsLookup [ matchesIn ] = axLayoutIn . type ;
204
+ missingMatchedAxisIds = Object . keys ( missingMatchedAxisIdsLookup ) ;
201
205
}
202
206
}
203
207
@@ -269,7 +273,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
269
273
270
274
coerce ( 'title.standoff' ) ;
271
275
272
- addMissingMatchedAxis ( axLayoutIn . matches ) ;
276
+ addMissingMatchedAxis ( ) ;
273
277
274
278
axLayoutOut . _input = axLayoutIn ;
275
279
}
@@ -305,7 +309,8 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
305
309
306
310
coerce ( 'uirevision' , layoutOut . uirevision ) ;
307
311
308
- handleTypeDefaults ( axLayoutIn , axLayoutOut , coerce , defaultOptions2 ) ;
312
+ axLayoutOut . type = missingMatchedAxisIdsLookup [ axId ] || 'linear' ;
313
+
309
314
handleAxisDefaults ( axLayoutIn , axLayoutOut , coerce , defaultOptions2 , layoutOut ) ;
310
315
311
316
handlePositionDefaults ( axLayoutIn , axLayoutOut , coerce , {
@@ -317,7 +322,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
317
322
318
323
coerce ( 'fixedrange' ) ;
319
324
320
- addMissingMatchedAxis ( axLayoutIn . matches ) ;
325
+ addMissingMatchedAxis ( ) ;
321
326
322
327
axLayoutOut . _input = axLayoutIn ;
323
328
}
0 commit comments