@@ -189,15 +189,19 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
189189 var counterAxes = { x : getCounterAxes ( 'x' ) , y : getCounterAxes ( 'y' ) } ;
190190 // list of all x AND y axis ids
191191 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,
193193 // even though they are missing from allAxisIds
194+ var missingMatchedAxisIdsLookup = { } ;
194195 var missingMatchedAxisIds = [ ] ;
195196
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 ;
199202 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 ) ;
201205 }
202206 }
203207
@@ -269,7 +273,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
269273
270274 coerce ( 'title.standoff' ) ;
271275
272- addMissingMatchedAxis ( axLayoutIn . matches ) ;
276+ addMissingMatchedAxis ( ) ;
273277
274278 axLayoutOut . _input = axLayoutIn ;
275279 }
@@ -305,7 +309,8 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
305309
306310 coerce ( 'uirevision' , layoutOut . uirevision ) ;
307311
308- handleTypeDefaults ( axLayoutIn , axLayoutOut , coerce , defaultOptions2 ) ;
312+ axLayoutOut . type = missingMatchedAxisIdsLookup [ axId ] || 'linear' ;
313+
309314 handleAxisDefaults ( axLayoutIn , axLayoutOut , coerce , defaultOptions2 , layoutOut ) ;
310315
311316 handlePositionDefaults ( axLayoutIn , axLayoutOut , coerce , {
@@ -317,7 +322,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
317322
318323 coerce ( 'fixedrange' ) ;
319324
320- addMissingMatchedAxis ( axLayoutIn . matches ) ;
325+ addMissingMatchedAxis ( ) ;
321326
322327 axLayoutOut . _input = axLayoutIn ;
323328 }
0 commit comments