Commit | Line | Data |
---|---|---|
e88a95b4 | 1 | /*global Gallery,Dygraph,data */ |
c1f22b5a RK |
2 | Gallery.register( |
3 | 'avoid-min-zero', | |
4 | { | |
5 | name: "Avoid Min Zero", | |
6 | setup: function(parent) { | |
7 | parent.innerHTML = | |
8 | "<p>1: Line chart with axis at zero problem:</p><div id='graph1'></div> " + | |
9 | "<p>2: Step chart with axis at zero problem:</p><div id='graphd2'></div> " + | |
10 | "<p>3: Line chart with <code>avoidMinZero</code> option:</p><div id='graph3'></div> " + | |
11 | "<p>4: Step chart with <code>avoidMinZero</code> option:</p><div id='graphd4'></div> "; | |
12 | }, | |
13 | run: function() { | |
e88a95b4 | 14 | new Dygraph(document.getElementById("graph1"), |
c1f22b5a RK |
15 | "Date,Temperature\n" + |
16 | "2008-05-07,0\n" + | |
17 | "2008-05-08,1\n" + | |
18 | "2008-05-09,0\n" + | |
19 | "2008-05-10,0\n" + | |
20 | "2008-05-11,3\n" + | |
21 | "2008-05-12,4\n" | |
e1e80cce | 22 | ); |
e88a95b4 | 23 | new Dygraph(document.getElementById("graphd2"), |
c1f22b5a RK |
24 | "Date,Temperature\n" + |
25 | "2008-05-07,0\n" + | |
26 | "2008-05-08,1\n" + | |
27 | "2008-05-09,0\n" + | |
28 | "2008-05-10,0\n" + | |
29 | "2008-05-11,3\n" + | |
30 | "2008-05-12,4\n", | |
31 | { | |
32 | stepPlot: true | |
33 | } | |
e1e80cce | 34 | ); |
e88a95b4 | 35 | new Dygraph(document.getElementById("graph3"), |
c1f22b5a RK |
36 | "Date,Temperature\n" + |
37 | "2008-05-07,0\n" + | |
38 | "2008-05-08,1\n" + | |
39 | "2008-05-09,0\n" + | |
40 | "2008-05-10,0\n" + | |
41 | "2008-05-11,3\n" + | |
42 | "2008-05-12,4\n", | |
43 | { | |
44 | avoidMinZero: true | |
45 | } | |
e1e80cce | 46 | ); |
e88a95b4 | 47 | new Dygraph(document.getElementById("graphd4"), |
c1f22b5a RK |
48 | "Date,Temperature\n" + |
49 | "2008-05-07,0\n" + | |
50 | "2008-05-08,1\n" + | |
51 | "2008-05-09,0\n" + | |
52 | "2008-05-10,0\n" + | |
53 | "2008-05-11,3\n" + | |
54 | "2008-05-12,4\n", | |
55 | { | |
56 | stepPlot: true, | |
57 | avoidMinZero: true | |
58 | } | |
e1e80cce | 59 | ); |
c1f22b5a RK |
60 | } |
61 | }); |