File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 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() {
8787 expect ( layoutOut . annotations [ 0 ] . x ) . toEqual ( '2008-07-01' ) ;
8888 expect ( layoutOut . annotations [ 0 ] . ax ) . toEqual ( '2004-07-01' ) ;
8989 } ) ;
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+ } ) ;
90125 } ) ;
91126} ) ;
92127
You can’t perform that action at this time.
0 commit comments