@@ -554,9 +554,9 @@ describe('annotations autorange', function() {
554
554
it ( 'should adapt to relayout calls' , function ( done ) {
555
555
Plotly . plot ( gd , mock ) . then ( function ( ) {
556
556
assertRanges (
557
- [ 0.97 , 2.03 ] , [ 0.97 , 2.03 ] ,
558
- [ '2000-10-01 08:23:18.0583 ' , '2001-06-05 19:20:23.301 ' ] , [ - 0.245 , 4.245 ] ,
559
- [ 0.9 , 2.1 ] , [ 0.86 , 2.14 ]
557
+ [ 0.91 , 2.09 ] , [ 0.91 , 2.09 ] ,
558
+ [ '2000-11-13 ' , '2001-04-21 ' ] , [ - 0.069 , 3.917 ] ,
559
+ [ 0.88 , 2.05 ] , [ 0.92 , 2.08 ]
560
560
) ;
561
561
562
562
return Plotly . relayout ( gd , {
@@ -567,9 +567,9 @@ describe('annotations autorange', function() {
567
567
} )
568
568
. then ( function ( ) {
569
569
assertRanges (
570
- [ 1.44 , 2.02 ] , [ 0.97 , 2.03 ] ,
571
- [ '2001-01-18 15:06:04.0449 ' , '2001-03-27 14:01:20.8989 ' ] , [ - 0.245 , 4.245 ] ,
572
- [ 1.44 , 2.1 ] , [ 0.86 , 2.14 ]
570
+ [ 1.44 , 2.02 ] , [ 0.91 , 2.09 ] ,
571
+ [ '2001-01-18' , '2001-03-27' ] , [ - 0.069 , 3.917 ] ,
572
+ [ 1.44 , 2.1 ] , [ 0.92 , 2.08 ]
573
573
) ;
574
574
575
575
return Plotly . relayout ( gd , {
@@ -581,8 +581,8 @@ describe('annotations autorange', function() {
581
581
. then ( function ( ) {
582
582
assertRanges (
583
583
[ 1.44 , 2.02 ] , [ 0.99 , 1.52 ] ,
584
- [ '2001-01-31 23:59:59.999' , '2001-02-01 00:00:00.001' ] , [ - 0.245 , 4.245 ] ,
585
- [ 0.5 , 2.5 ] , [ 0.86 , 2.14 ]
584
+ [ '2001-01-31 23:59:59.999' , '2001-02-01 00:00:00.001' ] , [ - 0.069 , 3.917 ] ,
585
+ [ 0.5 , 2.5 ] , [ 0.92 , 2.08 ]
586
586
) ;
587
587
588
588
return Plotly . relayout ( gd , {
@@ -596,9 +596,9 @@ describe('annotations autorange', function() {
596
596
} )
597
597
. then ( function ( ) {
598
598
assertRanges (
599
- [ 0.97 , 2.03 ] , [ 0.97 , 2.03 ] ,
600
- [ '2000-10-01 08:23:18.0583 ' , '2001-06-05 19:20:23.301 ' ] , [ - 0.245 , 4.245 ] ,
601
- [ 0.9 , 2.1 ] , [ 0.86 , 2.14 ]
599
+ [ 0.91 , 2.09 ] , [ 0.91 , 2.09 ] ,
600
+ [ '2000-11-13 ' , '2001-04-21 ' ] , [ - 0.069 , 3.917 ] ,
601
+ [ 0.88 , 2.05 ] , [ 0.92 , 2.08 ]
602
602
) ;
603
603
} )
604
604
. catch ( failTest )
@@ -619,10 +619,10 @@ describe('annotations autorange', function() {
619
619
} )
620
620
. then ( function ( ) {
621
621
assertRanges (
622
- [ - 1.09 , 2.09 ] , [ 0.94 , 3.06 ] ,
622
+ [ - 1.09 , 2.25 ] , [ 0.84 , 3.06 ] ,
623
623
// the other axes shouldn't change
624
- [ '2000-10-01 08:23:18.0583 ' , '2001-06-05 19:20:23.301 ' ] , [ - 0.245 , 4.245 ] ,
625
- [ 0.9 , 2.1 ] , [ 0.86 , 2.14 ]
624
+ [ '2000-11-13 ' , '2001-04-21 ' ] , [ - 0.069 , 3.917 ] ,
625
+ [ 0.88 , 2.05 ] , [ 0.92 , 2.08 ]
626
626
) ;
627
627
} )
628
628
. catch ( failTest )
@@ -961,7 +961,8 @@ describe('annotation effects', function() {
961
961
showarrow : false ,
962
962
text : 'blah<br>blah blah' ,
963
963
xref : 'paper' ,
964
- yref : 'paper'
964
+ yref : 'paper' ,
965
+ xshift : 5 , yshift : 5
965
966
} ] )
966
967
. then ( function ( ) {
967
968
var bbox = textBox ( ) . getBoundingClientRect ( ) ;
@@ -981,7 +982,8 @@ describe('annotation effects', function() {
981
982
xref : 'paper' ,
982
983
yref : 'paper' ,
983
984
xanchor : 'left' ,
984
- yanchor : 'top'
985
+ yanchor : 'top' ,
986
+ xshift : 5 , yshift : 5
985
987
} ] )
986
988
. then ( function ( ) {
987
989
// with offsets 0, 0 because the anchor doesn't change now
@@ -999,7 +1001,8 @@ describe('annotation effects', function() {
999
1001
xref : 'paper' ,
1000
1002
yref : 'paper' ,
1001
1003
ax : 30 ,
1002
- ay : 30
1004
+ ay : 30 ,
1005
+ xshift : 5 , yshift : 5
1003
1006
} ] )
1004
1007
. then ( function ( ) {
1005
1008
return checkDragging ( arrowDrag , 0 , 0 , 1 ) ;
@@ -1014,7 +1017,8 @@ describe('annotation effects', function() {
1014
1017
x : 0 ,
1015
1018
y : 0 ,
1016
1019
showarrow : false ,
1017
- text : 'blah<br>blah blah'
1020
+ text : 'blah<br>blah blah' ,
1021
+ xshift : 5 , yshift : 5
1018
1022
} ] )
1019
1023
. then ( function ( ) {
1020
1024
return checkDragging ( textDrag , 0 , 0 , 100 ) ;
@@ -1029,7 +1033,8 @@ describe('annotation effects', function() {
1029
1033
y : 0 ,
1030
1034
text : 'blah<br>blah blah' ,
1031
1035
ax : 30 ,
1032
- ay : - 30
1036
+ ay : - 30 ,
1037
+ xshift : 5 , yshift : 5
1033
1038
} ] )
1034
1039
. then ( function ( ) {
1035
1040
return checkDragging ( arrowDrag , 0 , 0 , 100 ) ;
@@ -1127,7 +1132,7 @@ describe('annotation effects', function() {
1127
1132
}
1128
1133
1129
1134
makePlot ( [
1130
- { x : 50 , y : 50 , text : 'hi' , width : 50 , ax : 0 , ay : - 40 } ,
1135
+ { x : 50 , y : 50 , text : 'hi' , width : 50 , ax : 0 , ay : - 40 , xshift : - 50 , yshift : 50 } ,
1131
1136
{ x : 20 , y : 20 , text : 'bye' , height : 40 , showarrow : false } ,
1132
1137
{ x : 80 , y : 80 , text : 'why?' , ax : 0 , ay : - 40 }
1133
1138
] , { } ) // turn off the default editable: true
@@ -1136,7 +1141,7 @@ describe('annotation effects', function() {
1136
1141
gd . on ( 'plotly_clickannotation' , function ( evt ) { clickData . push ( evt ) ; } ) ;
1137
1142
1138
1143
gdBB = gd . getBoundingClientRect ( ) ;
1139
- pos0Head = [ gdBB . left + 250 , gdBB . top + 250 ] ;
1144
+ pos0Head = [ gdBB . left + 200 , gdBB . top + 200 ] ;
1140
1145
pos0 = [ pos0Head [ 0 ] , pos0Head [ 1 ] - 40 ] ;
1141
1146
pos1 = [ gdBB . left + 160 , gdBB . top + 340 ] ;
1142
1147
pos2Head = [ gdBB . left + 340 , gdBB . top + 160 ] ;
0 commit comments