@@ -96,6 +96,20 @@ describe('calculated data and points', function() {
96
96
expect ( gd . calcdata [ 0 ] [ 4 ] ) . toEqual ( jasmine . objectContaining ( { x : 1 , y : 14 } ) ) ;
97
97
} ) ;
98
98
99
+ it ( 'should output categories in ascending domain alphanumerical order even if categories are all numbers' , function ( ) {
100
+
101
+ Plotly . plot ( gd , [ { x : [ 3 , 1 , 5 , 2 , 4 ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , { xaxis : {
102
+ type : 'category' ,
103
+ categorymode : 'category ascending'
104
+ } } ) ;
105
+
106
+ expect ( gd . calcdata [ 0 ] [ 0 ] ) . toEqual ( jasmine . objectContaining ( { x : 2 , y : 15 } ) ) ;
107
+ expect ( gd . calcdata [ 0 ] [ 1 ] ) . toEqual ( jasmine . objectContaining ( { x : 0 , y : 11 } ) ) ;
108
+ expect ( gd . calcdata [ 0 ] [ 2 ] ) . toEqual ( jasmine . objectContaining ( { x : 4 , y : 12 } ) ) ;
109
+ expect ( gd . calcdata [ 0 ] [ 3 ] ) . toEqual ( jasmine . objectContaining ( { x : 1 , y : 13 } ) ) ;
110
+ expect ( gd . calcdata [ 0 ] [ 4 ] ) . toEqual ( jasmine . objectContaining ( { x : 3 , y : 14 } ) ) ;
111
+ } ) ;
112
+
99
113
it ( 'should output categories in categorymode order even if category array is defined' , function ( ) {
100
114
101
115
Plotly . plot ( gd , [ { x : [ 'c' , 'a' , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , { xaxis : {
@@ -189,6 +203,21 @@ describe('calculated data and points', function() {
189
203
expect ( gd . calcdata [ 0 ] [ 4 ] ) . toEqual ( jasmine . objectContaining ( { x : 2 , y : 14 } ) ) ;
190
204
} ) ;
191
205
206
+ it ( 'should output categories in explicitly supplied order even if category values are all numbers' , function ( ) {
207
+
208
+ Plotly . plot ( gd , [ { x : [ 3 , 1 , 5 , 2 , 4 ] , y : [ 15 , 11 , 12 , 13 , 14 ] } ] , { xaxis : {
209
+ type : 'category' ,
210
+ categorymode : 'array' ,
211
+ categorylist : [ 2 , 1 , 4 , 5 , 3 ]
212
+ } } ) ;
213
+
214
+ expect ( gd . calcdata [ 0 ] [ 0 ] ) . toEqual ( jasmine . objectContaining ( { x : 4 , y : 15 } ) ) ;
215
+ expect ( gd . calcdata [ 0 ] [ 1 ] ) . toEqual ( jasmine . objectContaining ( { x : 1 , y : 11 } ) ) ;
216
+ expect ( gd . calcdata [ 0 ] [ 2 ] ) . toEqual ( jasmine . objectContaining ( { x : 3 , y : 12 } ) ) ;
217
+ expect ( gd . calcdata [ 0 ] [ 3 ] ) . toEqual ( jasmine . objectContaining ( { x : 0 , y : 13 } ) ) ;
218
+ expect ( gd . calcdata [ 0 ] [ 4 ] ) . toEqual ( jasmine . objectContaining ( { x : 2 , y : 14 } ) ) ;
219
+ } ) ;
220
+
192
221
it ( 'should output categories in explicitly supplied order, independent of trace order, pruned' , function ( ) {
193
222
194
223
Plotly . plot ( gd , [ { x : [ 'c' , undefined , 'e' , 'b' , 'd' ] , y : [ 15 , 11 , 12 , null , 14 ] } ] , { xaxis : {
0 commit comments