@@ -459,13 +459,28 @@ proto.plot = function(sceneData, fullLayout, layout) {
459
459
if ( axis . autorange ) {
460
460
sceneBounds [ 0 ] [ i ] = Infinity ;
461
461
sceneBounds [ 1 ] [ i ] = - Infinity ;
462
- for ( j = 0 ; j < this . glplot . objects . length ; ++ j ) {
463
- var objBounds = this . glplot . objects [ j ] . bounds ;
464
- sceneBounds [ 0 ] [ i ] = Math . min ( sceneBounds [ 0 ] [ i ] ,
465
- objBounds [ 0 ] [ i ] / dataScale [ i ] ) ;
466
- sceneBounds [ 1 ] [ i ] = Math . max ( sceneBounds [ 1 ] [ i ] ,
467
- objBounds [ 1 ] [ i ] / dataScale [ i ] ) ;
462
+
463
+ var objects = this . glplot . objects ;
464
+ var annotations = this . fullSceneLayout . annotations || [ ] ;
465
+ var axLetter = axis . _name . charAt ( 0 ) ;
466
+
467
+ for ( j = 0 ; j < objects . length ; j ++ ) {
468
+ var objBounds = objects [ j ] . bounds ;
469
+ sceneBounds [ 0 ] [ i ] = Math . min ( sceneBounds [ 0 ] [ i ] , objBounds [ 0 ] [ i ] / dataScale [ i ] ) ;
470
+ sceneBounds [ 1 ] [ i ] = Math . max ( sceneBounds [ 1 ] [ i ] , objBounds [ 1 ] [ i ] / dataScale [ i ] ) ;
471
+ }
472
+
473
+ for ( j = 0 ; j < annotations . length ; j ++ ) {
474
+ var ann = annotations [ j ] ;
475
+
476
+ // N.B. not taking into consideration the arrowhead
477
+ if ( ann . visible ) {
478
+ var pos = axis . r2l ( ann [ axLetter ] ) ;
479
+ sceneBounds [ 0 ] [ i ] = Math . min ( sceneBounds [ 0 ] [ i ] , pos ) ;
480
+ sceneBounds [ 1 ] [ i ] = Math . max ( sceneBounds [ 1 ] [ i ] , pos ) ;
481
+ }
468
482
}
483
+
469
484
if ( 'rangemode' in axis && axis . rangemode === 'tozero' ) {
470
485
sceneBounds [ 0 ] [ i ] = Math . min ( sceneBounds [ 0 ] [ i ] , 0 ) ;
471
486
sceneBounds [ 1 ] [ i ] = Math . max ( sceneBounds [ 1 ] [ i ] , 0 ) ;
@@ -793,6 +808,9 @@ function mockAnnAxes(ann, scene) {
793
808
// to get setConvert to not execute cleanly
794
809
type : 'linear' ,
795
810
811
+ // don't try to update them on `editable: true`
812
+ autorange : false ,
813
+
796
814
// set infinite range so that annotation draw routine
797
815
// does not try to remove 'outside-range' annotations,
798
816
// this case is handled in the render loop
0 commit comments