2 * @fileoverview FILL THIS IN
4 * @author danvk@google.com (Dan Vanderkam)
6 var errorBarsTestCase
= TestCase("error-bars");
8 errorBarsTestCase
.prototype.setUp
= function() {
9 document
.body
.innerHTML
= "<div id='graph'></div>";
12 var _origFunc
= Dygraph
.getContext
;
13 errorBarsTestCase
.prototype.setUp
= function() {
14 document
.body
.innerHTML
= "<div id='graph'></div>";
15 Dygraph
.getContext
= function(canvas
) {
16 return new Proxy(_origFunc(canvas
));
20 errorBarsTestCase
.prototype.tearDown
= function() {
21 Dygraph
.getContext
= _origFunc
;
24 errorBarsTestCase
.prototype.testNameGoesHere
= function() {
47 var graph
= document
.getElementById("graph");
48 var g
= new Dygraph(graph
, data
, opts
);
52 var attrs
= {}; // TODO(danvk): fill in
54 for (var i
= 0; i
< data
.length
- 1; i
++) {
56 var xy1
= g
.toDomCoords(data
[i
][0], data
[i
][1][0]);
57 var xy2
= g
.toDomCoords(data
[i
+ 1][0], data
[i
+ 1][1][0]);
58 CanvasAssertions
.assertLineDrawn(htx
, xy1
, xy2
, attrs
);
61 xy1
= g
.toDomCoords(data
[i
][0], data
[i
][1][2]);
62 xy2
= g
.toDomCoords(data
[i
+ 1][0], data
[i
+ 1][1][2]);
63 CanvasAssertions
.assertLineDrawn(htx
, xy1
, xy2
, attrs
);
66 xy1
= g
.toDomCoords(data
[i
][0], data
[i
][1][1]);
67 xy2
= g
.toDomCoords(data
[i
+ 1][0], data
[i
+ 1][1][1]);
68 CanvasAssertions
.assertLineDrawn(htx
, xy1
, xy2
, attrs
);
71 g
.updateOptions({logscale
: true});
73 for (var i
= 0; i
< data
.length
- 1; i
++) {
75 var xy1
= g
.toDomCoords(data
[i
][0], data
[i
][1][0]);
76 var xy2
= g
.toDomCoords(data
[i
+ 1][0], data
[i
+ 1][1][0]);
77 CanvasAssertions
.assertLineDrawn(htx
, xy1
, xy2
, attrs
);
80 xy1
= g
.toDomCoords(data
[i
][0], data
[i
][1][2]);
81 xy2
= g
.toDomCoords(data
[i
+ 1][0], data
[i
+ 1][1][2]);
82 CanvasAssertions
.assertLineDrawn(htx
, xy1
, xy2
, attrs
);
85 xy1
= g
.toDomCoords(data
[i
][0], data
[i
][1][1]);
86 xy2
= g
.toDomCoords(data
[i
+ 1][0], data
[i
+ 1][1][1]);
87 CanvasAssertions
.assertLineDrawn(htx
, xy1
, xy2
, attrs
);