@@ -4798,11 +4798,6 @@ describe('hovermode: (x|y)unified', function() {
47984798 }
47994799 } )
48004800 . then ( function ( gd ) {
4801- _hover ( gd , { xpx : 25 , ypx : 250 } ) ;
4802- assertLabel ( { title : 'Jan 1, 2017' , items : [
4803- 'scatter : 1'
4804- ] } ) ;
4805-
48064801 _hover ( gd , { xpx : 50 , ypx : 250 } ) ;
48074802 assertLabel ( { title : 'Feb 1, 2017' , items : [
48084803 'scatter : 2'
@@ -4875,6 +4870,135 @@ describe('hovermode: (x|y)unified', function() {
48754870 . then ( done , done . fail ) ;
48764871 } ) ;
48774872
4873+ it ( 'case of M1 period bars overlaid on M3 period bars' , function ( done ) {
4874+ Plotly . newPlot ( gd , {
4875+ data : [
4876+ {
4877+ type : 'bar' ,
4878+ name : 'M3' ,
4879+ xperiod : 'M3' ,
4880+ x : [
4881+ '2017-04' ,
4882+ '2017-07' ,
4883+ '2017-10' ,
4884+ '2018-01'
4885+ ] ,
4886+ y : [ 10 , 5 , 10 , 5 ]
4887+ } ,
4888+ {
4889+ type : 'bar' ,
4890+ name : 'M1' ,
4891+ xperiod : 'M1' ,
4892+ x : [
4893+ '2017-01' ,
4894+ '2017-02' ,
4895+ '2017-03' ,
4896+ '2017-04' ,
4897+ '2017-05' ,
4898+ '2017-06' ,
4899+ '2017-07' ,
4900+ '2017-08' ,
4901+ '2017-09' ,
4902+ '2017-10' ,
4903+ '2017-11' ,
4904+ '2017-12'
4905+ ] ,
4906+ y : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 ]
4907+ }
4908+ ] ,
4909+ layout : {
4910+ barmode : 'overlay' ,
4911+ hovermode : 'x unified' ,
4912+ showlegend : false ,
4913+ width : 500 ,
4914+ height : 500 ,
4915+ margin : {
4916+ t : 50 ,
4917+ b : 50 ,
4918+ l : 50 ,
4919+ r : 50
4920+ }
4921+ }
4922+ } )
4923+ . then ( function ( gd ) {
4924+ _hover ( gd , { xpx : 25 , ypx : 250 } ) ;
4925+ assertLabel ( { title : 'Jan 1, 2017' , items : [
4926+ 'M1 : 1'
4927+ ] } ) ;
4928+
4929+ _hover ( gd , { xpx : 50 , ypx : 250 } ) ;
4930+ assertLabel ( { title : 'Feb 1, 2017' , items : [
4931+ 'M1 : 2'
4932+ ] } ) ;
4933+
4934+ _hover ( gd , { xpx : 75 , ypx : 250 } ) ;
4935+ assertLabel ( { title : 'Mar 1, 2017' , items : [
4936+ 'M1 : 3' ,
4937+ 'M1 : (Feb 1, 2017, 2)'
4938+ ] } ) ;
4939+
4940+ _hover ( gd , { xpx : 100 , ypx : 250 } ) ;
4941+ assertLabel ( { title : 'Apr 1, 2017' , items : [
4942+ 'M3 : 10' ,
4943+ 'M1 : 4'
4944+ ] } ) ;
4945+
4946+ _hover ( gd , { xpx : 125 , ypx : 250 } ) ;
4947+ assertLabel ( { title : 'May 1, 2017' , items : [
4948+ 'M3 : (Apr 1, 2017, 10)' ,
4949+ 'M1 : 5'
4950+ ] } ) ;
4951+
4952+ _hover ( gd , { xpx : 150 , ypx : 250 } ) ;
4953+ assertLabel ( { title : 'Jun 1, 2017' , items : [
4954+ 'M3 : (Apr 1, 2017, 10)' ,
4955+ 'M1 : 6'
4956+ ] } ) ;
4957+
4958+ _hover ( gd , { xpx : 175 , ypx : 250 } ) ;
4959+ assertLabel ( { title : 'Jul 1, 2017' , items : [
4960+ 'M3 : 5' ,
4961+ 'M1 : 7'
4962+ ] } ) ;
4963+
4964+ _hover ( gd , { xpx : 200 , ypx : 250 } ) ;
4965+ assertLabel ( { title : 'Aug 1, 2017' , items : [
4966+ 'M3 : (Jul 1, 2017, 5)' ,
4967+ 'M1 : 8'
4968+ ] } ) ;
4969+
4970+ _hover ( gd , { xpx : 225 , ypx : 250 } ) ;
4971+ assertLabel ( { title : 'Sep 1, 2017' , items : [
4972+ 'M3 : (Jul 1, 2017, 5)' ,
4973+ 'M1 : 9'
4974+ ] } ) ;
4975+
4976+ _hover ( gd , { xpx : 250 , ypx : 250 } ) ;
4977+ assertLabel ( { title : 'Oct 1, 2017' , items : [
4978+ 'M3 : 10' ,
4979+ 'M1 : 10'
4980+ ] } ) ;
4981+
4982+ _hover ( gd , { xpx : 275 , ypx : 250 } ) ;
4983+ assertLabel ( { title : 'Nov 1, 2017' , items : [
4984+ 'M3 : (Oct 1, 2017, 10)' ,
4985+ 'M1 : 11'
4986+ ] } ) ;
4987+
4988+ _hover ( gd , { xpx : 300 , ypx : 250 } ) ;
4989+ assertLabel ( { title : 'Dec 1, 2017' , items : [
4990+ 'M3 : (Oct 1, 2017, 10)' ,
4991+ 'M1 : 12'
4992+ ] } ) ;
4993+
4994+ _hover ( gd , { xpx : 350 , ypx : 250 } ) ;
4995+ assertLabel ( { title : 'Jan 1, 2018' , items : [
4996+ 'M3 : 5'
4997+ ] } ) ;
4998+ } )
4999+ . then ( done , done . fail ) ;
5000+ } ) ;
5001+
48785002 it ( 'should have the same traceorder as the legend' , function ( done ) {
48795003 var mock = require ( '@mocks/stacked_area.json' ) ;
48805004 var mockCopy = Lib . extendDeep ( { } , mock ) ;
0 commit comments