@@ -18,6 +18,7 @@ var Plots = require('../plots/plots');
18
18
var AxisIds = require ( '../plots/cartesian/axis_ids' ) ;
19
19
var cleanId = AxisIds . cleanId ;
20
20
var getFromTrace = AxisIds . getFromTrace ;
21
+ var id2name = AxisIds . id2name ;
21
22
var Color = require ( '../components/color' ) ;
22
23
23
24
@@ -570,25 +571,35 @@ exports.hasParent = function(aobj, attr) {
570
571
* @param {object } layoutUpdate: any update being done concurrently to the layout,
571
572
* which may supercede clearing the axis types
572
573
*/
573
- var axLetters = [ 'x' , 'y' , 'z' ] ;
574
+ var xy = [ 'x' , 'y' ] ;
575
+ var xyz = [ 'x' , 'y' , 'z' ] ;
574
576
exports . clearAxisTypes = function ( gd , traces , layoutUpdate ) {
575
577
for ( var i = 0 ; i < traces . length ; i ++ ) {
576
578
var trace = gd . _fullData [ i ] ;
577
- for ( var j = 0 ; j < 3 ; j ++ ) {
578
- var ax = getFromTrace ( gd , trace , axLetters [ j ] ) ;
579
-
580
- // do not clear log type - that's never an auto result so must have been intentional
581
- if ( ax && ax . type !== 'log' ) {
582
- var axAttr = ax . _name ;
583
- var sceneName = ax . _id . substr ( 1 ) ;
584
- if ( sceneName . substr ( 0 , 5 ) === 'scene' ) {
585
- if ( layoutUpdate [ sceneName ] !== undefined ) continue ;
586
- axAttr = sceneName + '.' + axAttr ;
587
- }
588
- var typeAttr = axAttr + '.type' ;
589
-
590
- if ( layoutUpdate [ axAttr ] === undefined && layoutUpdate [ typeAttr ] === undefined ) {
591
- Lib . nestedProperty ( gd . layout , typeAttr ) . set ( null ) ;
579
+ var letters = Registry . traceIs ( trace , 'gl3d' ) ? xyz : xy ;
580
+
581
+ for ( var j = 0 ; j < letters . length ; j ++ ) {
582
+ var l = letters [ j ] ;
583
+ var axes = trace . type === 'splom' ?
584
+ trace [ l + 'axes' ] . map ( function ( id ) { return gd . _fullLayout [ id2name ( id ) ] ; } ) :
585
+ [ getFromTrace ( gd , trace , l ) ] ;
586
+
587
+ for ( var k = 0 ; k < axes . length ; k ++ ) {
588
+ var ax = axes [ k ] ;
589
+
590
+ // do not clear log type - that's never an auto result so must have been intentional
591
+ if ( ax && ax . type !== 'log' ) {
592
+ var axAttr = ax . _name ;
593
+ var sceneName = ax . _id . substr ( 1 ) ;
594
+ if ( sceneName . substr ( 0 , 5 ) === 'scene' ) {
595
+ if ( layoutUpdate [ sceneName ] !== undefined ) continue ;
596
+ axAttr = sceneName + '.' + axAttr ;
597
+ }
598
+ var typeAttr = axAttr + '.type' ;
599
+
600
+ if ( layoutUpdate [ axAttr ] === undefined && layoutUpdate [ typeAttr ] === undefined ) {
601
+ Lib . nestedProperty ( gd . layout , typeAttr ) . set ( null ) ;
602
+ }
592
603
}
593
604
}
594
605
}
0 commit comments