diff --git a/src/components/fx/helpers.js b/src/components/fx/helpers.js index a2b5580d026..0f6b0aa52d4 100644 --- a/src/components/fx/helpers.js +++ b/src/components/fx/helpers.js @@ -94,6 +94,10 @@ function quadrature(dx, dy) { exports.appendArrayPointValue = function(pointData, trace, pointNumber) { var arrayAttrs = trace._arrayAttrs; + if(!arrayAttrs) { + return; + } + for(var i = 0; i < arrayAttrs.length; i++) { var astr = arrayAttrs[i]; var key; diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index 72dee431d46..5498d69aff1 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -1299,3 +1299,28 @@ describe('Test hover label custom styling:', function() { .then(done); }); }); + +describe('ohlc hover interactions', function() { + var data = [{ + type: 'candlestick', + x: ['2011-01-01', '2012-01-01'], + open: [2, 2], + high: [3, 3], + low: [0, 0], + close: [3, 3], + }]; + + beforeEach(function() { + this.gd = createGraphDiv(); + }); + + afterEach(destroyGraphDiv); + + // See: https://github.com/plotly/plotly.js/issues/1807 + it('should not fail in appendArrayPointValue', function() { + Plotly.plot(this.gd, data); + mouseEvent('mousemove', 203, 213); + + expect(d3.select('.hovertext').size()).toBe(1); + }); +});