@@ -6901,6 +6901,73 @@ describe('hovermode: (x|y)unified', function() {
69016901 } )
69026902 . then ( done , done . fail ) ;
69036903 } ) ;
6904+
6905+ it ( 'should format title of unified hover in respect to `unifiedhovertemplate` linear axis' , function ( done ) {
6906+ Plotly . newPlot ( gd , [ {
6907+ type : 'bar' ,
6908+ y : [ 1 , 2 , 3 ]
6909+ } , {
6910+ type : 'scatter' ,
6911+ y : [ 2 , 3 , 1 ]
6912+ } ] , {
6913+ xaxis : {
6914+ unifiedhovertemplate : 'X: %{x:.2f}' ,
6915+ } ,
6916+ hovermode : 'x unified' ,
6917+ showlegend : false ,
6918+ width : 500 ,
6919+ height : 500 ,
6920+ margin : {
6921+ t : 50 ,
6922+ b : 50 ,
6923+ l : 50 ,
6924+ r : 50
6925+ }
6926+ } )
6927+ . then ( function ( ) {
6928+ _hover ( gd , { xpx : 200 , ypx : 200 } ) ;
6929+ assertLabel ( { title : 'X: 1.00' , items : [
6930+ 'trace 0 : 2' ,
6931+ 'trace 1 : 3'
6932+ ] } ) ;
6933+ } )
6934+ . then ( done , done . fail ) ;
6935+ } ) ;
6936+
6937+ it ( 'should format title of unified hover in respect to `unifiedhovertemplate` date axis' , function ( done ) {
6938+ Plotly . newPlot ( gd , [ {
6939+ type : 'bar' ,
6940+ x : [ '2000-01-01' , '2000-02-01' , '2000-03-01' ] ,
6941+ y : [ 1 , 2 , 3 ]
6942+ } , {
6943+ type : 'scatter' ,
6944+ x : [ '2000-01-01' , '2000-02-01' , '2000-03-01' ] ,
6945+ y : [ 2 , 3 , 1 ]
6946+ } ] , {
6947+ xaxis : {
6948+ type : 'date' ,
6949+ unifiedhovertemplate : 'X: %{x|%x %X}' ,
6950+ } ,
6951+ hovermode : 'x unified' ,
6952+ showlegend : false ,
6953+ width : 500 ,
6954+ height : 500 ,
6955+ margin : {
6956+ t : 50 ,
6957+ b : 50 ,
6958+ l : 50 ,
6959+ r : 50
6960+ }
6961+ } )
6962+ . then ( function ( ) {
6963+ _hover ( gd , { xpx : 200 , ypx : 200 } ) ;
6964+ assertLabel ( { title : 'X: 02/01/2000 00:00:00' , items : [
6965+ 'trace 0 : 2' ,
6966+ 'trace 1 : 3'
6967+ ] } ) ;
6968+ } )
6969+ . then ( done , done . fail ) ;
6970+ } ) ;
69046971} ) ;
69056972
69066973describe ( 'hover on traces with (x|y)hoverformat' , function ( ) {
0 commit comments