@@ -1070,6 +1070,84 @@ describe('hover info', function() {
10701070 } )
10711071 . then ( done , done . fail ) ;
10721072 } ) ;
1073+ it ( 'should display correct label when customdata is typed array - x/y/z heatmap|contour' , function ( done ) {
1074+ Plotly . newPlot ( gd , [ {
1075+ type : 'heatmap' ,
1076+ x : [ 1 , 1 , 2 , 2 ] ,
1077+ y : [ 1 , 2 , 1 , 2 ] ,
1078+ z : [ 1 , 2 , 3 , 4 ] ,
1079+ customdata : new Float64Array ( [ 100 , 200 , 300 , 400 ] ) ,
1080+ hovertemplate : '%{customdata}<extra>%{data.type}: %{pointNumber}</extra>'
1081+ } ] , {
1082+ width : 400 ,
1083+ height : 400 ,
1084+ margin : { l : 0 , t : 0 , r : 0 , b : 0 }
1085+ } )
1086+ . then ( function ( ) {
1087+ _hover ( gd , 50 , 50 ) ;
1088+ assertHoverLabelContent ( {
1089+ nums : '200' ,
1090+ name : 'heatmap: 1'
1091+ } ) ;
1092+ _hover ( gd , 250 , 300 ) ;
1093+ assertHoverLabelContent ( {
1094+ nums : '300' ,
1095+ name : 'heatmap: 2'
1096+ } ) ;
1097+ } )
1098+ . then ( function ( ) { return Plotly . restyle ( gd , 'type' , 'contour' ) ; } )
1099+ . then ( function ( ) {
1100+ _hover ( gd , 50 , 50 ) ;
1101+ assertHoverLabelContent ( {
1102+ nums : '200' ,
1103+ name : 'contour: 1'
1104+ } ) ;
1105+ _hover ( gd , 250 , 300 ) ;
1106+ assertHoverLabelContent ( {
1107+ nums : '300' ,
1108+ name : 'contour: 2'
1109+ } ) ;
1110+ } )
1111+ . then ( done , done . fail ) ;
1112+ } ) ;
1113+ it ( 'should display correct label when customdata contains typed arrays - z heatmap|contour' , function ( done ) {
1114+ Plotly . newPlot ( gd , [ {
1115+ type : 'heatmap' ,
1116+ z : [ [ 1 , 3 ] , [ 2 , 4 ] ] ,
1117+ customdata :[ new Float64Array ( [ 100 , 300 ] ) , new Float64Array ( [ 200 , 400 ] ) ] ,
1118+ hovertemplate : '%{customdata}<extra>%{data.type}: %{pointNumber}</extra>'
1119+ } ] , {
1120+ width : 400 ,
1121+ height : 400 ,
1122+ margin : { l : 0 , t : 0 , r : 0 , b : 0 }
1123+ } )
1124+ . then ( function ( ) {
1125+ _hover ( gd , 50 , 50 ) ;
1126+ assertHoverLabelContent ( {
1127+ nums : '200' ,
1128+ name : 'heatmap: 1,0'
1129+ } ) ;
1130+ _hover ( gd , 250 , 300 ) ;
1131+ assertHoverLabelContent ( {
1132+ nums : '300' ,
1133+ name : 'heatmap: 0,1'
1134+ } ) ;
1135+ } )
1136+ . then ( function ( ) { return Plotly . restyle ( gd , 'type' , 'contour' ) ; } )
1137+ . then ( function ( ) {
1138+ _hover ( gd , 50 , 50 ) ;
1139+ assertHoverLabelContent ( {
1140+ nums : '200' ,
1141+ name : 'contour: 1,0'
1142+ } ) ;
1143+ _hover ( gd , 250 , 300 ) ;
1144+ assertHoverLabelContent ( {
1145+ nums : '300' ,
1146+ name : 'contour: 0,1'
1147+ } ) ;
1148+ } )
1149+ . then ( done , done . fail ) ;
1150+ } ) ;
10731151 } ) ;
10741152
10751153 describe ( 'hover info for negative data on a log axis' , function ( ) {
0 commit comments