@@ -6,7 +6,7 @@ var createGraphDiv = require('../assets/create_graph_div');
66var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
77var click = require ( '../assets/click' ) ;
88
9- function makePlot ( gd , layoutExtras = { } , traceExtras = { } , configExtras ) {
9+ function makePlot ( gd , traceExtras = { } , layoutExtras = { } , configExtras ) {
1010 return Plotly . newPlot (
1111 gd ,
1212 [
@@ -42,11 +42,12 @@ var dayEnd = new Date(2026, 5, 1);
4242
4343// the 300px-wide plot area spans exactly one day, so 0px is local midnight
4444// and 150px is local noon, in any timezone
45- function makeDatePlot ( gd , layoutExtras ) {
46- return makePlot ( gd , Lib . extendFlat ( { xaxis : { type : 'date' , range : [ dayStart , dayEnd ] } } , layoutExtras ) , {
47- x : [ dayStart , dayNoon ] ,
48- y : [ 1 , 3 ]
49- } ) ;
45+ function makeDatePlot ( gd , traceExtras , layoutExtras ) {
46+ return makePlot (
47+ gd ,
48+ Lib . extendFlat ( { x : [ dayStart , dayNoon ] , y : [ 1 , 3 ] } , traceExtras ) ,
49+ Lib . extendFlat ( { xaxis : { type : 'date' , range : [ dayStart , dayEnd ] } } , layoutExtras )
50+ ) ;
5051}
5152
5253describe ( 'hoveranywhere' , ( ) => {
@@ -75,7 +76,7 @@ describe('hoveranywhere', () => {
7576 it ( 'emits plotly_hover with coordinate data on empty space' , ( done ) => {
7677 var hoverData ;
7778
78- makePlot ( gd , { hoveranywhere : true } )
79+ makePlot ( gd , { } , { hoveranywhere : true } )
7980 . then ( ( ) => {
8081 gd . on ( 'plotly_hover' , ( d ) => ( hoverData = d ) ) ;
8182
@@ -111,7 +112,7 @@ describe('hoveranywhere', () => {
111112 it ( 'still returns normal point data on traces' , ( done ) => {
112113 var hoverData ;
113114
114- makePlot ( gd , { hoveranywhere : true } )
115+ makePlot ( gd , { } , { hoveranywhere : true } )
115116 . then ( ( ) => {
116117 gd . on ( 'plotly_hover' , ( d ) => ( hoverData = d ) ) ;
117118
@@ -149,7 +150,7 @@ describe('hoveranywhere', () => {
149150 it ( 'respects hovermode:false' , ( done ) => {
150151 var hoverData ;
151152
152- makePlot ( gd , { hoveranywhere : true , hovermode : false } )
153+ makePlot ( gd , { } , { hoveranywhere : true , hovermode : false } )
153154 . then ( ( ) => {
154155 gd . on ( 'plotly_hover' , ( d ) => ( hoverData = d ) ) ;
155156 _hover ( 250 , 50 ) ;
@@ -161,7 +162,7 @@ describe('hoveranywhere', () => {
161162 it ( 'emits plotly_hover over an editable shape' , ( done ) => {
162163 let hoverData ;
163164
164- makePlot ( gd , {
165+ makePlot ( gd , { } , {
165166 hoveranywhere : true ,
166167 shapes : [
167168 {
@@ -209,6 +210,7 @@ describe('hoveranywhere', () => {
209210
210211 makePlot (
211212 gd ,
213+ { } ,
212214 {
213215 hoveranywhere : true ,
214216 shapes : [
@@ -222,7 +224,6 @@ describe('hoveranywhere', () => {
222224 }
223225 ]
224226 } ,
225- { } ,
226227 { edits : { shapePosition : true } }
227228 )
228229 . then ( ( ) => {
@@ -253,7 +254,7 @@ describe('hoveranywhere', () => {
253254 it ( 'reports date axis positions as date strings' , ( done ) => {
254255 var hoverData ;
255256
256- makeDatePlot ( gd , { hoveranywhere : true } )
257+ makeDatePlot ( gd , { } , { hoveranywhere : true } )
257258 . then ( ( ) => {
258259 gd . on ( 'plotly_hover' , ( d ) => ( hoverData = d ) ) ;
259260
@@ -278,8 +279,8 @@ describe('hoveranywhere', () => {
278279
279280 makePlot (
280281 gd ,
281- { xaxis : { type : 'category' } , yaxis : { type : 'log' , range : [ 1 , 3 ] } , hoveranywhere : true } ,
282- { x : [ 'a' , 'b' , 'c' ] , y : [ 10 , 20 , 30 ] }
282+ { x : [ 'a' , 'b' , 'c' ] , y : [ 10 , 20 , 30 ] } ,
283+ { xaxis : { type : 'category' } , yaxis : { type : 'log' , range : [ 1 , 3 ] } , hoveranywhere : true }
283284 )
284285 . then ( ( ) => {
285286 gd . on ( 'plotly_hover' , ( d ) => ( hoverData = d ) ) ;
@@ -311,7 +312,7 @@ describe('clickanywhere', () => {
311312 it ( 'emits plotly_click with empty points on empty space' , ( done ) => {
312313 var clickData ;
313314
314- makePlot ( gd , { clickanywhere : true } )
315+ makePlot ( gd , { } , { clickanywhere : true } )
315316 . then ( ( ) => {
316317 gd . on ( 'plotly_click' , ( d ) => ( clickData = d ) ) ;
317318
@@ -352,7 +353,7 @@ describe('clickanywhere', () => {
352353 it ( 'emits plotly_click over an editable shape' , ( done ) => {
353354 let clickData ;
354355
355- makePlot ( gd , {
356+ makePlot ( gd , { } , {
356357 clickanywhere : true ,
357358 shapes : [
358359 {
@@ -396,6 +397,7 @@ describe('clickanywhere', () => {
396397
397398 makePlot (
398399 gd ,
400+ { } ,
399401 {
400402 clickanywhere : true ,
401403 shapes : [
@@ -409,7 +411,6 @@ describe('clickanywhere', () => {
409411 }
410412 ]
411413 } ,
412- { } ,
413414 { edits : { shapePosition : true } }
414415 )
415416 . then ( ( ) => {
@@ -438,7 +439,7 @@ describe('clickanywhere', () => {
438439 it ( 'reports date axis positions as date strings' , ( done ) => {
439440 var clickData ;
440441
441- makeDatePlot ( gd , { clickanywhere : true } )
442+ makeDatePlot ( gd , { } , { clickanywhere : true } )
442443 . then ( ( ) => {
443444 gd . on ( 'plotly_click' , ( d ) => ( clickData = d ) ) ;
444445
0 commit comments