@@ -5266,73 +5266,75 @@ describe('hovermode: (x|y)unified', function() {
5266
5266
} ) ;
5267
5267
} ) ;
5268
5268
5269
- it ( 'period points alignments' , function ( done ) {
5270
- Plotly . newPlot ( gd , {
5271
- data : [
5272
- {
5273
- name : 'bar' ,
5274
- type : 'bar' ,
5275
- x : [ '2000-01' , '2000-02' ] ,
5276
- y : [ 1 , 2 ] ,
5277
- xhoverfrmat : '%b' ,
5278
- xperiod : 'M1'
5279
- } ,
5280
- {
5281
- name : 'start' ,
5282
- type : 'scatter' ,
5283
- x : [ '2000-01' , '2000-02' ] ,
5284
- y : [ 1 , 2 ] ,
5285
- xhoverformat : '%b' ,
5286
- xperiod : 'M1' ,
5287
- xperiodalignment : 'start'
5288
- } ,
5289
- {
5290
- name : 'end' ,
5291
- type : 'scatter' ,
5292
- x : [ '2000-01' , '2000-02' ] ,
5293
- y : [ 1 , 2 ] ,
5294
- xhoverformat : '%b' ,
5295
- xperiod : 'M1' ,
5296
- xperiodalignment : 'end'
5297
- } ,
5298
- ] ,
5299
- layout : {
5300
- showlegend : false ,
5301
- width : 600 ,
5302
- height : 400 ,
5303
- hovermode : 'x unified'
5304
- }
5305
- } )
5306
- . then ( function ( gd ) {
5307
- _hover ( gd , { xpx : 40 , ypx : 200 } ) ;
5308
- assertLabel ( { title : 'Jan' , items : [
5309
- 'bar : (Jan 1, 2000, 1)' ,
5310
- 'start : 1' ,
5311
- 'end : 1'
5312
- ] } ) ;
5269
+ [ 'scatter' , 'scattergl' ] . forEach ( function ( scatterType ) {
5270
+ it ( scatterType + ' period points alignments' , function ( done ) {
5271
+ Plotly . newPlot ( gd , {
5272
+ data : [
5273
+ {
5274
+ name : 'bar' ,
5275
+ type : 'bar' ,
5276
+ x : [ '2000-01' , '2000-02' ] ,
5277
+ y : [ 1 , 2 ] ,
5278
+ xhoverfrmat : '%b' ,
5279
+ xperiod : 'M1'
5280
+ } ,
5281
+ {
5282
+ name : 'start' ,
5283
+ type : scatterType ,
5284
+ x : [ '2000-01' , '2000-02' ] ,
5285
+ y : [ 1 , 2 ] ,
5286
+ xhoverformat : '%b' ,
5287
+ xperiod : 'M1' ,
5288
+ xperiodalignment : 'start'
5289
+ } ,
5290
+ {
5291
+ name : 'end' ,
5292
+ type : 'scatter' ,
5293
+ x : [ '2000-01' , '2000-02' ] ,
5294
+ y : [ 1 , 2 ] ,
5295
+ xhoverformat : '%b' ,
5296
+ xperiod : 'M1' ,
5297
+ xperiodalignment : 'end'
5298
+ } ,
5299
+ ] ,
5300
+ layout : {
5301
+ showlegend : false ,
5302
+ width : 600 ,
5303
+ height : 400 ,
5304
+ hovermode : 'x unified'
5305
+ }
5306
+ } )
5307
+ . then ( function ( gd ) {
5308
+ _hover ( gd , { xpx : 40 , ypx : 200 } ) ;
5309
+ assertLabel ( { title : 'Jan' , items : [
5310
+ 'bar : (Jan 1, 2000, 1)' ,
5311
+ 'start : 1' ,
5312
+ 'end : 1'
5313
+ ] } ) ;
5313
5314
5314
- _hover ( gd , { xpx : 100 , ypx : 200 } ) ;
5315
- assertLabel ( { title : 'Jan' , items : [
5316
- 'bar : (Jan 1, 2000, 1)' ,
5317
- 'start : 1' ,
5318
- 'end : 1'
5319
- ] } ) ;
5315
+ _hover ( gd , { xpx : 100 , ypx : 200 } ) ;
5316
+ assertLabel ( { title : 'Jan' , items : [
5317
+ 'bar : (Jan 1, 2000, 1)' ,
5318
+ 'start : 1' ,
5319
+ 'end : 1'
5320
+ ] } ) ;
5320
5321
5321
- _hover ( gd , { xpx : 360 , ypx : 200 } ) ;
5322
- assertLabel ( { title : 'Feb' , items : [
5323
- 'bar : (Feb 1, 2000, 2)' ,
5324
- 'start : 2' ,
5325
- 'end : 2'
5326
- ] } ) ;
5322
+ _hover ( gd , { xpx : 360 , ypx : 200 } ) ;
5323
+ assertLabel ( { title : 'Feb' , items : [
5324
+ 'bar : (Feb 1, 2000, 2)' ,
5325
+ 'start : 2' ,
5326
+ 'end : 2'
5327
+ ] } ) ;
5327
5328
5328
- _hover ( gd , { xpx : 400 , ypx : 200 } ) ;
5329
- assertLabel ( { title : 'Feb' , items : [
5330
- 'bar : (Feb 1, 2000, 2)' ,
5331
- 'start : 2' ,
5332
- 'end : 2'
5333
- ] } ) ;
5334
- } )
5335
- . then ( done , done . fail ) ;
5329
+ _hover ( gd , { xpx : 400 , ypx : 200 } ) ;
5330
+ assertLabel ( { title : 'Feb' , items : [
5331
+ 'bar : (Feb 1, 2000, 2)' ,
5332
+ 'start : 2' ,
5333
+ 'end : 2'
5334
+ ] } ) ;
5335
+ } )
5336
+ . then ( done , done . fail ) ;
5337
+ } ) ;
5336
5338
} ) ;
5337
5339
5338
5340
it ( 'period with hover distance -1 include closest not farthest' , function ( done ) {
0 commit comments