diff --git a/draftlogs/5836_fix.md b/draftlogs/5836_fix.md deleted file mode 100644 index a2ebe2be9f6..00000000000 --- a/draftlogs/5836_fix.md +++ /dev/null @@ -1 +0,0 @@ - - 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 550f514246f..4cc6d19e802 100644 --- a/src/components/fx/hover.js +++ b/src/components/fx/hover.js @@ -1072,11 +1072,8 @@ function createHoverText(hoverData, opts, gd) { // Position the hover var winningPoint = hoverData[0]; - 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 ly = (winningPoint.y0 + winningPoint.y1) / 2; + var lx = (winningPoint.x0 + winningPoint.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 d0a9d3e4693..7efbf5b96d9 100644 --- a/src/traces/scatter/calc.js +++ b/src/traces/scatter/calc.js @@ -51,6 +51,9 @@ 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]); @@ -58,6 +61,13 @@ 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 459538e4b6d..b4b6a62dd23 100644 --- a/src/traces/scatter/hover.js +++ b/src/traces/scatter/hover.js @@ -28,12 +28,14 @@ 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) { @@ -69,8 +71,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.x; - var yLabelVal = (orientation === 'v') ? sizeVal : di.y; + 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; Lib.extendFlat(pointData, { color: getTraceColor(trace, di), diff --git a/src/traces/scattergl/hover.js b/src/traces/scattergl/hover.js index 8645c315786..e1b2a16ecd5 100644 --- a/src/traces/scattergl/hover.js +++ b/src/traces/scattergl/hover.js @@ -48,9 +48,11 @@ 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]; } @@ -153,16 +155,19 @@ 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: di.x, + xLabelVal: origX ? origX[id] : di.x, y0: yp - rad, y1: yp + rad, - yLabelVal: di.y, + yLabelVal: origY ? origY[id] : 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 10f6e326e7c..c7f72916244 100644 --- a/test/jasmine/tests/gl2d_click_test.js +++ b/test/jasmine/tests/gl2d_click_test.js @@ -627,12 +627,6 @@ 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({ @@ -647,50 +641,6 @@ 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 1937c67ba03..f804dc6e367 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: '(Jul 2001, 1)' + nums: '(Jan 2001, 1)' }); }) .then(function() { _hover(290, 285); }) .then(function() { assertHoverLabelContent({ name: 'scatter', - nums: '(Jul 2004, 4)' + nums: '(Jan 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, Jul 2001)' + nums: '(1, Jan 2001)' }); }) .then(function() { _hover(305, 120); }) .then(function() { assertHoverLabelContent({ name: 'scatter2', - nums: '(4, Jul 2004)' + nums: '(4, Jan 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 1, 2001, 2)' + nums: '(Jan 15, 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: '(Feb 1, 2001, 1)' + nums: '(Jan 1, 2001, 1)' }); }) .then(function() { _hover(135, 395); }) .then(function() { assertHoverLabelContent({ name: 'end (M1)', - nums: '(Feb 1, 2001, 2)' + nums: '(Jan 15, 2001, 2)' }); }) @@ -2914,7 +2914,7 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'start (M2)', - nums: '(Jan 1, 2001, 2)' + nums: '(Feb 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: '(Mar 1, 2001, 1)' + nums: '(Jan 1, 2001, 1)' }); }) .then(function() { _hover(135, 175); }) .then(function() { assertHoverLabelContent({ name: 'end (M2)', - nums: '(Mar 1, 2001, 2)' + nums: '(Feb 1, 2001, 2)' }); }) @@ -2971,14 +2971,14 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'end (M3)', - nums: '(Q2, 1)' + nums: '(Q1, 1)' }); }) .then(function() { _hover(415, 395); }) .then(function() { assertHoverLabelContent({ name: 'end (M3)', - nums: '(Q2, 2)' + nums: '(Q1, 2)' }); }) @@ -2993,7 +2993,7 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'start (M12)', - nums: '(Jan 2001, 2)' + nums: '(Jul 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 2002, 1)' + nums: '(Jan 2001, 1)' }); }) .then(function() { _hover(700, 395); }) .then(function() { assertHoverLabelContent({ name: 'end (M12)', - nums: '(Jan 2002, 2)' + nums: '(Jul 2001, 2)' }); }) @@ -3050,14 +3050,14 @@ describe('hover on traces with (x|y)period positioning', function() { .then(function() { assertHoverLabelContent({ name: 'end (W1)', - nums: '(W02, 1)' + nums: '(W01, 1)' }); }) .then(function() { _hover(700, 175); }) .then(function() { assertHoverLabelContent({ name: 'end (W1)', - nums: '(W02, 2)' + nums: '(W01, 2)' }); }) @@ -5220,219 +5220,120 @@ describe('hovermode: (x|y)unified', function() { .then(done, done.fail); }); - 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' - ]}); - - _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: 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: 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: 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: 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: 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, - ] + [{ + 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' } - ], - 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 3, 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 8, 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 13, 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 28, 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 2, 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 12, 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 17, 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 22, 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 3, 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 8, 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); + }); }); ['scatter', 'scattergl'].forEach(function(scatterType) { @@ -5458,7 +5359,7 @@ describe('hovermode: (x|y)unified', function() { }, { name: 'end', - type: scatterType, + type: 'scatter', x: ['2000-01', '2000-02'], y: [1, 2], xhoverformat: '%b', @@ -5477,24 +5378,28 @@ describe('hovermode: (x|y)unified', function() { _hover(gd, { xpx: 40, ypx: 200 }); assertLabel({title: 'Jan', items: [ 'bar : (Jan 1, 2000, 1)', - 'start : 1' + 'start : 1', + 'end : 1' ]}); _hover(gd, { xpx: 100, ypx: 200 }); assertLabel({title: 'Jan', items: [ 'bar : (Jan 1, 2000, 1)', - 'start : 1' + 'start : 1', + 'end : 1' ]}); _hover(gd, { xpx: 360, ypx: 200 }); assertLabel({title: 'Feb', items: [ 'bar : (Feb 1, 2000, 2)', 'start : 2', - 'end : 1' + 'end : 2' ]}); _hover(gd, { xpx: 400, ypx: 200 }); - assertLabel({title: 'Mar', items: [ + assertLabel({title: 'Feb', items: [ + 'bar : (Feb 1, 2000, 2)', + 'start : 2', 'end : 2' ]}); }) @@ -5502,52 +5407,6 @@ 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: [