diff --git a/draftlogs/5836_fix.md b/draftlogs/5836_fix.md new file mode 100644 index 00000000000..a2ebe2be9f6 --- /dev/null +++ b/draftlogs/5836_fix.md @@ -0,0 +1 @@ + - Fix `scatter` and `scattergl` hover on axes with period and adjust the unified hover position in respect to mean [[#5836](https://github.com/plotly/plotly.js/pull/5836)] diff --git a/src/components/fx/hover.js b/src/components/fx/hover.js index 4cc6d19e802..550f514246f 100644 --- a/src/components/fx/hover.js +++ b/src/components/fx/hover.js @@ -1072,8 +1072,11 @@ function createHoverText(hoverData, opts, gd) { // Position the hover var winningPoint = hoverData[0]; - var ly = (winningPoint.y0 + winningPoint.y1) / 2; - var lx = (winningPoint.x0 + winningPoint.x1) / 2; + var ly = axLetter === 'y' ? + (winningPoint.y0 + winningPoint.y1) / 2 : Lib.mean(hoverData.map(function(c) {return (c.y0 + c.y1) / 2;})); + var lx = axLetter === 'x' ? + (winningPoint.x0 + winningPoint.x1) / 2 : Lib.mean(hoverData.map(function(c) {return (c.x0 + c.x1) / 2;})); + var legendContainer = container.select('g.legend'); var tbb = legendContainer.node().getBoundingClientRect(); lx += xa._offset; diff --git a/src/traces/scatter/calc.js b/src/traces/scatter/calc.js index 7efbf5b96d9..d0a9d3e4693 100644 --- a/src/traces/scatter/calc.js +++ b/src/traces/scatter/calc.js @@ -51,9 +51,6 @@ function calc(gd, trace) { calcAxisExpansion(gd, trace, xa, ya, x, y, ppad); } - var hasPeriodX = !!trace.xperiodalignment; - var hasPeriodY = !!trace.yperiodalignment; - for(i = 0; i < serieslen; i++) { var cdi = cd[i] = {}; var xValid = isNumeric(x[i]); @@ -61,13 +58,6 @@ function calc(gd, trace) { if(xValid && yValid) { cdi[xAttr] = x[i]; cdi[yAttr] = y[i]; - - if(hasPeriodX) { - cdi.orig_x = origX[i]; // used by hover - } - if(hasPeriodY) { - cdi.orig_y = origY[i]; // used by hover - } } else if(stackGroupOpts && (isV ? xValid : yValid)) { // if we're stacking we need to hold on to all valid positions // even with invalid sizes diff --git a/src/traces/scatter/hover.js b/src/traces/scatter/hover.js index b4b6a62dd23..459538e4b6d 100644 --- a/src/traces/scatter/hover.js +++ b/src/traces/scatter/hover.js @@ -28,14 +28,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { var rad = Math.max(3, di.mrc || 0); var kink = 1 - 1 / rad; var dxRaw = Math.abs(xa.c2p(di.x) - xpx); - if(di.orig_x !== undefined) dxRaw += xa.c2p(di.orig_x) - xa.c2p(di.x); return (dxRaw < rad) ? (kink * dxRaw / rad) : (dxRaw - rad + kink); }; var dy = function(di) { var rad = Math.max(3, di.mrc || 0); var kink = 1 - 1 / rad; var dyRaw = Math.abs(ya.c2p(di.y) - ypx); - if(di.orig_y !== undefined) dyRaw += ya.c2p(di.orig_y) - ya.c2p(di.y); return (dyRaw < rad) ? (kink * dyRaw / rad) : (dyRaw - rad + kink); }; var dxy = function(di) { @@ -71,8 +69,8 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { // the normalized individual sizes, so that's what I'm doing here // for now. var sizeVal = orientation && (di.sNorm || di.s); - var xLabelVal = (orientation === 'h') ? sizeVal : di.orig_x !== undefined ? di.orig_x : di.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.orig_y !== undefined ? di.orig_y : di.y; + var xLabelVal = (orientation === 'h') ? sizeVal : di.x; + var yLabelVal = (orientation === 'v') ? sizeVal : di.y; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), diff --git a/src/traces/scattergl/hover.js b/src/traces/scattergl/hover.js index e1b2a16ecd5..8645c315786 100644 --- a/src/traces/scattergl/hover.js +++ b/src/traces/scattergl/hover.js @@ -48,11 +48,9 @@ function hoverPoints(pointData, xval, yval, hovermode) { for(i = 0; i < ids.length; i++) { ptx = x[ids[i]]; dx = Math.abs(xa.c2p(ptx) - xpx); - if(trace._origX && trace._origX[i] !== undefined) dx += xa.c2p(trace._origX[i]) - xa.c2p(ptx); if(dx < minDist) { minDist = dx; dy = ya.c2p(y[ids[i]]) - ypx; - if(trace._origY && trace._origY[i] !== undefined) dy += ya.c2p(trace._origY[i]) - ya.c2p(pty); dxy = Math.sqrt(dx * dx + dy * dy); id = ids[i]; } @@ -155,19 +153,16 @@ function calcHover(pointData, x, y, trace) { var fakeCd = {}; fakeCd[pointData.index] = di; - var origX = trace._origX; - var origY = trace._origY; - var pointData2 = Lib.extendFlat({}, pointData, { color: getTraceColor(trace, di), x0: xp - rad, x1: xp + rad, - xLabelVal: origX ? origX[id] : di.x, + xLabelVal: di.x, y0: yp - rad, y1: yp + rad, - yLabelVal: origY ? origY[id] : di.y, + yLabelVal: di.y, cd: fakeCd, distance: minDist, diff --git a/test/jasmine/tests/gl2d_click_test.js b/test/jasmine/tests/gl2d_click_test.js index c7f72916244..10f6e326e7c 100644 --- a/test/jasmine/tests/gl2d_click_test.js +++ b/test/jasmine/tests/gl2d_click_test.js @@ -627,6 +627,12 @@ describe('hover with (x|y)period positioning', function() { it('@gl shows hover info for scattergl', function(done) { Plotly.newPlot(gd, require('@mocks/gl2d_period_positioning.json')) + .then(function() { + return Plotly.restyle(gd, { + xperiodalignment: 'start', + yperiodalignment: 'start' + }); + }) .then(function() { _hover(100, 255); }) .then(function() { assertHoverLabelContent({ @@ -641,6 +647,50 @@ describe('hover with (x|y)period positioning', function() { nums: '(Jan 2006, Jun 1, 1970)' }); }) + + .then(function() { + return Plotly.restyle(gd, { + xperiodalignment: 'middle', + yperiodalignment: 'middle' + }); + }) + .then(function() { _hover(100, 255); }) + .then(function() { _hover(100, 255); }) + .then(function() { + assertHoverLabelContent({ + name: '', + nums: '(Jul 2001, Jan 16, 1970)' + }); + }) + .then(function() { _hover(470, 45); }) + .then(function() { + assertHoverLabelContent({ + name: '', + nums: '(Jul 2006, Jun 16, 1970)' + }); + }) + + .then(function() { + return Plotly.restyle(gd, { + xperiodalignment: 'end', + yperiodalignment: 'end' + }); + }) + .then(function() { _hover(100, 255); }) + .then(function() { + assertHoverLabelContent({ + name: '', + nums: '(Jan 2002, Feb 1, 1970)' + }); + }) + .then(function() { _hover(470, 45); }) + .then(function() { + assertHoverLabelContent({ + name: '', + nums: '(Jan 2007, Jul 1, 1970)' + }); + }) + .then(done, done.fail); }); }); diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index f804dc6e367..1937c67ba03 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -2663,14 +2663,14 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'scatter', - nums: '(Jan 2001, 1)' + nums: '(Jul 2001, 1)' }); }) .then(function() { _hover(290, 285); }) .then(function() { assertHoverLabelContent({ name: 'scatter', - nums: '(Jan 2004, 4)' + nums: '(Jul 2004, 4)' }); }) .then(function() { _hover(110, 410); }) @@ -2705,14 +2705,14 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'scatter2', - nums: '(1, Jan 2001)' + nums: '(1, Jul 2001)' }); }) .then(function() { _hover(305, 120); }) .then(function() { assertHoverLabelContent({ name: 'scatter2', - nums: '(4, Jan 2004)' + nums: '(4, Jul 2004)' }); }) .then(function() { _hover(385, 355); }) @@ -2871,7 +2871,7 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'start (M1)', - nums: '(Jan 15, 2001, 2)' + nums: '(Jan 1, 2001, 2)' }); }) .then(function() { _hover(100, 425); }) @@ -2892,14 +2892,14 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'end (M1)', - nums: '(Jan 1, 2001, 1)' + nums: '(Feb 1, 2001, 1)' }); }) .then(function() { _hover(135, 395); }) .then(function() { assertHoverLabelContent({ name: 'end (M1)', - nums: '(Jan 15, 2001, 2)' + nums: '(Feb 1, 2001, 2)' }); }) @@ -2914,7 +2914,7 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'start (M2)', - nums: '(Feb 1, 2001, 2)' + nums: '(Jan 1, 2001, 2)' }); }) .then(function() { _hover(100, 205); }) @@ -2935,14 +2935,14 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'end (M2)', - nums: '(Jan 1, 2001, 1)' + nums: '(Mar 1, 2001, 1)' }); }) .then(function() { _hover(135, 175); }) .then(function() { assertHoverLabelContent({ name: 'end (M2)', - nums: '(Feb 1, 2001, 2)' + nums: '(Mar 1, 2001, 2)' }); }) @@ -2971,14 +2971,14 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'end (M3)', - nums: '(Q1, 1)' + nums: '(Q2, 1)' }); }) .then(function() { _hover(415, 395); }) .then(function() { assertHoverLabelContent({ name: 'end (M3)', - nums: '(Q1, 2)' + nums: '(Q2, 2)' }); }) @@ -2993,7 +2993,7 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'start (M12)', - nums: '(Jul 2001, 2)' + nums: '(Jan 2001, 2)' }); }) .then(function() { _hover(665, 425); }) @@ -3007,14 +3007,14 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'end (M12)', - nums: '(Jan 2001, 1)' + nums: '(Jan 2002, 1)' }); }) .then(function() { _hover(700, 395); }) .then(function() { assertHoverLabelContent({ name: 'end (M12)', - nums: '(Jul 2001, 2)' + nums: '(Jan 2002, 2)' }); }) @@ -3050,14 +3050,14 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'end (W1)', - nums: '(W01, 1)' + nums: '(W02, 1)' }); }) .then(function() { _hover(700, 175); }) .then(function() { assertHoverLabelContent({ name: 'end (W1)', - nums: '(W01, 2)' + nums: '(W02, 2)' }); }) @@ -5220,120 +5220,219 @@ describe('hovermode: (x|y)unified', function() { .then(done, done.fail); }); - [{ - xperiod: 0, - desc: 'non-period scatter points and period bars' - }, { - xperiod: 5 * 24 * 3600 * 1000, - desc: 'period scatter points and period bars' - }].forEach(function(t) { - it(t.desc, function(done) { - var fig = { - data: [ - { - name: 'bar', - type: 'bar', - x: ['1999-12', '2000-01', '2000-02'], - y: [2, 1, 3], - xhoverformat: '%b', - xperiod: 'M1' - }, - { - xperiod: t.xperiod, - name: 'scatter', - type: 'scatter', - x: [ - '2000-01-01', '2000-01-06', '2000-01-11', '2000-01-16', '2000-01-21', '2000-01-26', - '2000-02-01', '2000-02-06', '2000-02-11', '2000-02-16', '2000-02-21', '2000-02-26', - '2000-03-01', '2000-03-06', '2000-03-11', '2000-03-16', '2000-03-21', '2000-03-26' - ], - y: [ - 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, - 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, - 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, - ] - } - ], - layout: { - showlegend: false, - width: 600, - height: 400, - hovermode: 'x unified' + it('non-period scatter points and period bars', function(done) { + var fig = { + data: [ + { + name: 'bar', + type: 'bar', + x: ['1999-12', '2000-01', '2000-02'], + y: [2, 1, 3], + xhoverformat: '%b', + xperiod: 'M1' + }, + { + name: 'scatter', + type: 'scatter', + x: [ + '2000-01-01', '2000-01-06', '2000-01-11', '2000-01-16', '2000-01-21', '2000-01-26', + '2000-02-01', '2000-02-06', '2000-02-11', '2000-02-16', '2000-02-21', '2000-02-26', + '2000-03-01', '2000-03-06', '2000-03-11', '2000-03-16', '2000-03-21', '2000-03-26' + ], + y: [ + 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, + 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, + 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, + ] } - }; + ], + layout: { + showlegend: false, + width: 600, + height: 400, + hovermode: 'x unified' + } + }; - Plotly.newPlot(gd, fig) - .then(function(gd) { - _hover(gd, { xpx: 50, ypx: 200 }); - assertLabel({title: 'Dec', items: [ - 'bar : 2' - ]}); + Plotly.newPlot(gd, fig) + .then(function(gd) { + _hover(gd, { xpx: 50, ypx: 200 }); + assertLabel({title: 'Dec', items: [ + 'bar : 2' + ]}); - _hover(gd, { xpx: 75, ypx: 200 }); - assertLabel({title: 'Dec', items: [ - 'bar : 2' - ]}); + _hover(gd, { xpx: 75, ypx: 200 }); + assertLabel({title: 'Dec', items: [ + 'bar : 2' + ]}); - _hover(gd, { xpx: 100, ypx: 200 }); - assertLabel({title: 'Jan 1, 2000', items: [ - 'bar : (Jan, 1)', - 'scatter : 1.1' - ]}); + _hover(gd, { xpx: 100, ypx: 200 }); + assertLabel({title: 'Jan 1, 2000', items: [ + 'bar : (Jan, 1)', + 'scatter : 1.1' + ]}); - _hover(gd, { xpx: 125, ypx: 200 }); - assertLabel({title: 'Jan 6, 2000', items: [ - 'bar : (Jan, 1)', - 'scatter : 1.2' - ]}); + _hover(gd, { xpx: 125, ypx: 200 }); + assertLabel({title: 'Jan 6, 2000', items: [ + 'bar : (Jan, 1)', + 'scatter : 1.2' + ]}); - _hover(gd, { xpx: 150, ypx: 200 }); - assertLabel({title: 'Jan 11, 2000', items: [ - 'bar : (Jan, 1)', - 'scatter : 1.3' - ]}); + _hover(gd, { xpx: 150, ypx: 200 }); + assertLabel({title: 'Jan 11, 2000', items: [ + 'bar : (Jan, 1)', + 'scatter : 1.3' + ]}); - _hover(gd, { xpx: 200, ypx: 200 }); - assertLabel({title: 'Jan 26, 2000', items: [ - 'bar : (Jan, 1)', - 'scatter : 1.6' - ]}); + _hover(gd, { xpx: 200, ypx: 200 }); + assertLabel({title: 'Jan 26, 2000', items: [ + 'bar : (Jan, 1)', + 'scatter : 1.6' + ]}); - _hover(gd, { xpx: 225, ypx: 200 }); - assertLabel({title: 'Feb 1, 2000', items: [ - 'bar : (Feb, 3)', - 'scatter : 2.1' - ]}); + _hover(gd, { xpx: 225, ypx: 200 }); + assertLabel({title: 'Feb 1, 2000', items: [ + 'bar : (Feb, 3)', + 'scatter : 2.1' + ]}); - _hover(gd, { xpx: 250, ypx: 200 }); - assertLabel({title: 'Feb 11, 2000', items: [ - 'bar : (Feb, 3)', - 'scatter : 2.3' - ]}); + _hover(gd, { xpx: 250, ypx: 200 }); + assertLabel({title: 'Feb 11, 2000', items: [ + 'bar : (Feb, 3)', + 'scatter : 2.3' + ]}); - _hover(gd, { xpx: 275, ypx: 200 }); - assertLabel({title: 'Feb 16, 2000', items: [ - 'bar : (Feb, 3)', - 'scatter : 2.4' - ]}); + _hover(gd, { xpx: 275, ypx: 200 }); + assertLabel({title: 'Feb 16, 2000', items: [ + 'bar : (Feb, 3)', + 'scatter : 2.4' + ]}); - _hover(gd, { xpx: 300, ypx: 200 }); - assertLabel({title: 'Feb 21, 2000', items: [ - 'bar : (Feb, 3)', - 'scatter : 2.5' - ]}); + _hover(gd, { xpx: 300, ypx: 200 }); + assertLabel({title: 'Feb 21, 2000', items: [ + 'bar : (Feb, 3)', + 'scatter : 2.5' + ]}); - _hover(gd, { xpx: 325, ypx: 200 }); - assertLabel({title: 'Mar 1, 2000', items: [ - 'scatter : 3.1' - ]}); + _hover(gd, { xpx: 325, ypx: 200 }); + assertLabel({title: 'Mar 1, 2000', items: [ + 'scatter : 3.1' + ]}); - _hover(gd, { xpx: 350, ypx: 200 }); - assertLabel({title: 'Mar 6, 2000', items: [ - 'scatter : 3.2' - ]}); - }) - .then(done, done.fail); - }); + _hover(gd, { xpx: 350, ypx: 200 }); + assertLabel({title: 'Mar 6, 2000', items: [ + 'scatter : 3.2' + ]}); + }) + .then(done, done.fail); + }); + + it('period scatter points and period bars', function(done) { + var fig = { + data: [ + { + name: 'bar', + type: 'bar', + x: ['1999-12', '2000-01', '2000-02'], + y: [2, 1, 3], + xhoverformat: '%b', + xperiod: 'M1' + }, + { + xperiod: 5 * 24 * 3600 * 1000, + name: 'scatter', + type: 'scatter', + x: [ + '2000-01-01', '2000-01-06', '2000-01-11', '2000-01-16', '2000-01-21', '2000-01-26', + '2000-02-01', '2000-02-06', '2000-02-11', '2000-02-16', '2000-02-21', '2000-02-26', + '2000-03-01', '2000-03-06', '2000-03-11', '2000-03-16', '2000-03-21', '2000-03-26' + ], + y: [ + 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, + 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, + 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, + ] + } + ], + layout: { + showlegend: false, + width: 600, + height: 400, + hovermode: 'x unified' + } + }; + + Plotly.newPlot(gd, fig) + .then(function(gd) { + _hover(gd, { xpx: 50, ypx: 200 }); + assertLabel({title: 'Dec', items: [ + 'bar : 2' + ]}); + + _hover(gd, { xpx: 75, ypx: 200 }); + assertLabel({title: 'Dec', items: [ + 'bar : 2' + ]}); + + _hover(gd, { xpx: 100, ypx: 200 }); + assertLabel({title: 'Jan 3, 2000', items: [ + 'bar : (Jan, 1)', + 'scatter : 1.1' + ]}); + + _hover(gd, { xpx: 125, ypx: 200 }); + assertLabel({title: 'Jan 8, 2000', items: [ + 'bar : (Jan, 1)', + 'scatter : 1.2' + ]}); + + _hover(gd, { xpx: 150, ypx: 200 }); + assertLabel({title: 'Jan 13, 2000', items: [ + 'bar : (Jan, 1)', + 'scatter : 1.3' + ]}); + + _hover(gd, { xpx: 200, ypx: 200 }); + assertLabel({title: 'Jan 28, 2000', items: [ + 'bar : (Jan, 1)', + 'scatter : 1.6' + ]}); + + _hover(gd, { xpx: 225, ypx: 200 }); + assertLabel({title: 'Feb 2, 2000', items: [ + 'bar : (Feb, 3)', + 'scatter : 2.1' + ]}); + + _hover(gd, { xpx: 250, ypx: 200 }); + assertLabel({title: 'Feb 12, 2000', items: [ + 'bar : (Feb, 3)', + 'scatter : 2.3' + ]}); + + _hover(gd, { xpx: 275, ypx: 200 }); + assertLabel({title: 'Feb 17, 2000', items: [ + 'bar : (Feb, 3)', + 'scatter : 2.4' + ]}); + + _hover(gd, { xpx: 300, ypx: 200 }); + assertLabel({title: 'Feb 22, 2000', items: [ + 'bar : (Feb, 3)', + 'scatter : 2.5' + ]}); + + _hover(gd, { xpx: 325, ypx: 200 }); + assertLabel({title: 'Mar 3, 2000', items: [ + 'scatter : 3.1' + ]}); + + _hover(gd, { xpx: 350, ypx: 200 }); + assertLabel({title: 'Mar 8, 2000', items: [ + 'scatter : 3.2' + ]}); + }) + .then(done, done.fail); }); ['scatter', 'scattergl'].forEach(function(scatterType) { @@ -5359,7 +5458,7 @@ describe('hovermode: (x|y)unified', function() { }, { name: 'end', - type: 'scatter', + type: scatterType, x: ['2000-01', '2000-02'], y: [1, 2], xhoverformat: '%b', @@ -5378,28 +5477,24 @@ describe('hovermode: (x|y)unified', function() { _hover(gd, { xpx: 40, ypx: 200 }); assertLabel({title: 'Jan', items: [ 'bar : (Jan 1, 2000, 1)', - 'start : 1', - 'end : 1' + 'start : 1' ]}); _hover(gd, { xpx: 100, ypx: 200 }); assertLabel({title: 'Jan', items: [ 'bar : (Jan 1, 2000, 1)', - 'start : 1', - 'end : 1' + 'start : 1' ]}); _hover(gd, { xpx: 360, ypx: 200 }); assertLabel({title: 'Feb', items: [ 'bar : (Feb 1, 2000, 2)', 'start : 2', - 'end : 2' + 'end : 1' ]}); _hover(gd, { xpx: 400, ypx: 200 }); - assertLabel({title: 'Feb', items: [ - 'bar : (Feb 1, 2000, 2)', - 'start : 2', + assertLabel({title: 'Mar', items: [ 'end : 2' ]}); }) @@ -5407,6 +5502,52 @@ describe('hovermode: (x|y)unified', function() { }); }); + it('two end positioned scatter period', function(done) { + var fig = { + data: [{ + x: [ + '1970-01-01', + '1970-07-01', + '1971-01-01' + ], + xperiod: 'M6', + xperiodalignment: 'end', + y: [1, 2, 3] + }, { + x: [ + '1970-01-01', + '1970-07-01', + '1971-01-01', + ], + xperiod: 'M6', + xperiodalignment: 'end', + y: [11, 12, 13] + }], + layout: { + showlegend: false, + width: 600, + height: 400, + hovermode: 'x unified' + } + }; + + Plotly.newPlot(gd, fig) + .then(function(gd) { + _hover(gd, { xpx: 200, ypx: 200 }); + assertLabel({title: 'Jan 1, 1971', items: [ + 'trace 0 : 2', + 'trace 1 : 12' + ]}); + + _hover(gd, { xpx: 400, ypx: 200 }); + assertLabel({title: 'Jul 1, 1971', items: [ + 'trace 0 : 3', + 'trace 1 : 13' + ]}); + }) + .then(done, done.fail); + }); + it('period with hover distance -1 include closest not farthest', function(done) { Plotly.newPlot(gd, { data: [