File tree 1 file changed +35
-0
lines changed
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,41 @@ describe('Test annotations', function() {
87
87
expect ( layoutOut . annotations [ 0 ] . x ) . toEqual ( '2008-07-01' ) ;
88
88
expect ( layoutOut . annotations [ 0 ] . ax ) . toEqual ( '2004-07-01' ) ;
89
89
} ) ;
90
+
91
+ it ( 'should convert ax/ay category coordinates to linear coords' , function ( ) {
92
+ var layoutIn = {
93
+ annotations : [ {
94
+ showarrow : true ,
95
+ axref : 'x' ,
96
+ ayref : 'y' ,
97
+ x : 'c' ,
98
+ ax : 1 ,
99
+ y : 'A' ,
100
+ ay : 3
101
+ } ]
102
+ } ;
103
+
104
+ var layoutOut = {
105
+ xaxis : {
106
+ type : 'category' ,
107
+ _categories : [ 'a' , 'b' , 'c' ] ,
108
+ range : [ - 0.5 , 2.5 ] } ,
109
+ yaxis : {
110
+ type : 'category' ,
111
+ _categories : [ 'A' , 'B' , 'C' ] ,
112
+ range : [ - 0.5 , 3 ]
113
+ }
114
+ } ;
115
+ Axes . setConvert ( layoutOut . xaxis ) ;
116
+ Axes . setConvert ( layoutOut . yaxis ) ;
117
+
118
+ _supply ( layoutIn , layoutOut ) ;
119
+
120
+ expect ( layoutOut . annotations [ 0 ] . x ) . toEqual ( 2 ) ;
121
+ expect ( layoutOut . annotations [ 0 ] . ax ) . toEqual ( 1 ) ;
122
+ expect ( layoutOut . annotations [ 0 ] . y ) . toEqual ( 0 ) ;
123
+ expect ( layoutOut . annotations [ 0 ] . ay ) . toEqual ( 3 ) ;
124
+ } ) ;
90
125
} ) ;
91
126
} ) ;
92
127
You can’t perform that action at this time.
0 commit comments