Commit | Line | Data |
---|---|---|
e2d8db3a DV |
1 | /** |
2 | * @fileoverview FILL THIS IN | |
3 | * | |
4 | * @author danvk@google.com (Dan Vanderkam) | |
5 | */ | |
6 | var perSeriesTestCase = TestCase("per-series"); | |
7 | ||
8 | perSeriesTestCase.prototype.setUp = function() { | |
9 | document.body.innerHTML = "<div id='graph'></div>"; | |
10 | }; | |
11 | ||
12 | perSeriesTestCase.prototype.tearDown = function() { | |
13 | }; | |
14 | ||
e2d8db3a DV |
15 | |
16 | perSeriesTestCase.prototype.testPerSeriesFill = function() { | |
17 | var opts = { | |
18 | width: 480, | |
19 | height: 320, | |
20 | drawXGrid: false, | |
21 | drawYGrid: false, | |
22 | drawXAxis: false, | |
23 | drawYAxis: false, | |
24 | Y: { fillGraph: true }, | |
25 | colors: [ '#FF0000', '#0000FF' ], | |
26 | fillAlpha: 0.15 | |
27 | }; | |
28 | var data = "X,Y,Z\n" + | |
29 | "1,0,0\n" + | |
30 | "2,0,1\n" + | |
31 | "3,0,1\n" + | |
32 | "4,0,0\n" + | |
33 | "5,0,0\n" + | |
34 | "6,1,0\n" + | |
35 | "7,1,0\n" + | |
36 | "8,0,0\n" | |
37 | ; | |
38 | ||
39 | var graph = document.getElementById("graph"); | |
40 | g = new Dygraph(graph, data, opts); | |
41 | ||
42 | var sampler = new PixelSampler(g); | |
43 | ||
44 | // Inside of the "Z" bump -- no fill. | |
45 | assertEquals([0,0,0,0], sampler.colorAtCoordinate(2.5, 0.5)); | |
46 | ||
47 | // Inside of the "Y" bump -- filled in. | |
48 | assertEquals([255,0,0,38], sampler.colorAtCoordinate(6.5, 0.5)); | |
49 | }; | |
50 |