2 * @fileoverview Test cases for the option "connectSeparatedPoints" especially for the scenario where not every series has a value for each timestamp.
4 * @author julian.eichstaedt@ch.sauter-bc.com (Fr. Sauter AG)
6 var StepTestCase
= TestCase("connect_separated_points");
8 StepTestCase
.prototype.setUp
= function() {
9 document
.body
.innerHTML
= "<div id='graph'></div>";
12 StepTestCase
.origFunc
= Dygraph
.getContext
;
14 StepTestCase
.prototype.setUp
= function() {
15 document
.body
.innerHTML
= "<div id='graph'></div>";
16 Dygraph
.getContext
= function(canvas
) {
17 return new Proxy(StepTestCase
.origFunc(canvas
));
21 StepTestCase
.prototype.tearDown
= function() {
22 Dygraph
.getContext
= StepTestCase
.origFunc
;
25 StepTestCase
.prototype.testEdgePoints
= function() {
34 labels
: ["x", "series1", "series2"],
35 connectSeparatedPoints
: true,
51 var graph
= document
.getElementById("graph");
52 var g
= new Dygraph(graph
, data
, opts
);
58 //Test if series1 is drawn correctly.
59 //------------------------------------
61 // The first point of the first series
64 var xy1
= g
.toDomCoords(x1
, y1
);
66 // The third (the second valid) point of the first series
67 // This series has no value at the second position.
70 var xy2
= g
.toDomCoords(x2
, y2
);
72 // Check if both points are connected at the left edge of the canvas and if the option "connectSeparatedPoints" works properly
73 // even if the point is outside the visible range and only one series has a valid value for this point.
74 CanvasAssertions
.assertLineDrawn(htx
, xy1
, xy2
, attrs
);
76 //Test if series2 is drawn correctly.
77 //------------------------------------
79 // The sixth point of the second series
80 // Use the sixth and NOT the seventh point despite this series has eight points
81 // since this series has no value at the seventh position.
84 var xy1
= g
.toDomCoords(x1
, y1
);
86 // The last point of the second series.
89 var xy2
= g
.toDomCoords(x2
, y2
);
91 // Check if both points are connected at the right edge of the canvas and if the option "connectSeparatedPoints" works properly
92 // even if the point is outside the visible range and only one series has a valid value for this point.
93 CanvasAssertions
.assertLineDrawn(htx
, xy1
, xy2
, attrs
);