@@ -168,8 +168,8 @@ describe('heatmap convertColumnXYZ', function() {
168168 } ;
169169 }
170170
171- var xa = makeMockAxis ( ) ,
172- ya = makeMockAxis ( ) ;
171+ var xa = makeMockAxis ( ) ;
172+ var ya = makeMockAxis ( ) ;
173173
174174 it ( 'should convert x/y/z columns to z(x,y)' , function ( ) {
175175 trace = {
@@ -305,8 +305,13 @@ describe('heatmap calc', function() {
305305
306306 Plots . supplyDefaults ( gd ) ;
307307 var fullTrace = gd . _fullData [ 0 ] ;
308+ var fullLayout = gd . _fullLayout ;
308309
309- return Heatmap . calc ( gd , fullTrace ) [ 0 ] ;
310+ var out = Heatmap . calc ( gd , fullTrace ) [ 0 ] ;
311+ out . _xcategories = fullLayout . xaxis . _categories ;
312+ out . _ycategories = fullLayout . yaxis . _categories ;
313+
314+ return out ;
310315 }
311316
312317 it ( 'should fill in bricks if x/y not given' , function ( ) {
@@ -404,6 +409,25 @@ describe('heatmap calc', function() {
404409 expect ( out . y ) . toBeCloseToArray ( [ - 0.5 , 0.5 ] ) ;
405410 expect ( out . z ) . toBeCloseTo2DArray ( [ [ 17 , 18 , 19 ] ] ) ;
406411 } ) ;
412+
413+ it ( 'should handle the category x/y/z/ column case' , function ( ) {
414+ var out = _calc ( {
415+ x : [ 'a' , 'a' , 'a' , 'b' , 'b' , 'b' , 'c' , 'c' , 'c' ] ,
416+ y : [ 'A' , 'B' , 'C' , 'A' , 'B' , 'C' , 'A' , 'B' , 'C' ] ,
417+ z : [ 0 , 50 , 100 , 50 , 0 , 255 , 100 , 510 , 1010 ]
418+ } ) ;
419+
420+ expect ( out . x ) . toBeCloseToArray ( [ - 0.5 , 0.5 , 1.5 , 2.5 ] ) ;
421+ expect ( out . y ) . toBeCloseToArray ( [ - 0.5 , 0.5 , 1.5 , 2.5 ] ) ;
422+ expect ( out . z ) . toBeCloseTo2DArray ( [
423+ [ 0 , 50 , 100 ] ,
424+ [ 50 , 0 , 510 ] ,
425+ [ 100 , 255 , 1010 ]
426+ ] ) ;
427+
428+ expect ( out . _xcategories ) . toEqual ( [ 'a' , 'b' , 'c' ] ) ;
429+ expect ( out . _ycategories ) . toEqual ( [ 'A' , 'B' , 'C' ] ) ;
430+ } ) ;
407431} ) ;
408432
409433describe ( 'heatmap plot' , function ( ) {
0 commit comments