X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fconnect_separated_points.js;h=bec5a521220ded5dafbe1626db206e0891a9f3de;hb=d5ce61bccb248d7e60239c18068c2ba3aecdb3ec;hp=f668ebcaf63d05f9cf15ee1e0514eb090cb3aadd;hpb=d569e3a08324168e501e6ba1402273acdae554f9;p=dygraphs.git diff --git a/auto_tests/tests/connect_separated_points.js b/auto_tests/tests/connect_separated_points.js index f668ebc..bec5a52 100644 --- a/auto_tests/tests/connect_separated_points.js +++ b/auto_tests/tests/connect_separated_points.js @@ -363,20 +363,20 @@ ConnectSeparatedPointsTestCase.prototype.testConnectSeparatedPointsPerSeries = f } var g = new Dygraph(document.getElementById("graph"), - [ - [1, 10, 10, 10], - [2, 15, 11, 12], - [3, null, null, 12], - [4, 20, 14, null], - [5, 15, null, 17], - [6, 18, null, null], - [7, 12, 14, null] - ], - { - labels: ["Date","Series1","Series2","Series3"], - connectSeparatedPoints: false, - colors: ["#ff0000", "#00ff00", "#0000ff"] - }); + [ + [1, 10, 10, 10], + [2, 15, 11, 12], + [3, null, null, 12], + [4, 20, 14, null], + [5, 15, null, 17], + [6, 18, null, null], + [7, 12, 14, null] + ], + { + labels: ["Date","Series1","Series2","Series3"], + connectSeparatedPoints: false, + colors: ["#ff0000", "#00ff00", "#0000ff"] + }); htx = g.hidden_ctx_; assertExpectedLinesDrawnPerSeries(htx, 4, 1, 2); @@ -406,3 +406,44 @@ ConnectSeparatedPointsTestCase.prototype.testConnectSeparatedPointsPerSeries = f }); assertExpectedLinesDrawnPerSeries(htx, 4, 3, 3); } + +ConnectSeparatedPointsTestCase.prototype.testNaNErrorBars = function() { + var data = [ + [0,[1,2,3]], + [1,[2,3,4]], + [2,[3,4,5]], + [3,[null,null,null]], + [4,[2,3,4]], + [5,[3,4,5]], + [6,[2,3,4]], + [7,[NaN,NaN,NaN]], + [8,[2,3,4]], + [9,[2,3,4]], + [10,[2,3,4]], + [11,[2,3,4]] + ]; + + var opts = { + labels: ["x", "y"], + colors: ["#ff0000"], + customBars: true, + connectSeparatedPoints: true + }; + + var graph = document.getElementById("graph"); + var g = new Dygraph(graph, data, opts); + + htx = g.hidden_ctx_; + + var attrs = {}; + + // Line should be drawn across the null gap. + CanvasAssertions.assertLineDrawn(htx, + g.toDomCoords(data[2][0], data[2][1][1]), + g.toDomCoords(data[4][0], data[4][1][1]), + attrs); + + // No line across the NaN gap, and a single line (not two) + // across the null gap. + assertEquals(8, CanvasAssertions.numLinesDrawn(htx, '#ff0000')); +};