Move stock data into tests/data.js
[dygraphs.git] / gallery / negative.js
1 /*global Gallery,Dygraph,data */
2 Gallery.register(
3 'negative',
4 {
5 name: 'Negative values',
6 setup: function(parent) {
7 parent.innerHTML =
8 "<p>All negatives (x-axis on top):</p>" +
9 "<div id='g1' style='width:600px; height:200px;'></div>" +
10
11 "<p>Mixed (x-axis in middle):</p>" +
12 "<div id='g2' style='width:600px; height:200px;'></div>" +
13
14 "<p>All positives (x-axis on bottom):</p>" +
15 "<div id='g3' style='width:600px; height:200px;'></div>";
16 },
17 run: function() {
18 var negs = [];
19 var mixed = [];
20 var pos = [];
21 for (var i = 0; i < 100; i++) {
22 negs.push([i, -210 + i, -110 - i]);
23 mixed.push([i, -50 + i, 50 - i]);
24 pos.push([i, 1000 + 2 * i, 1100 + i]);
25 }
26
27 new Dygraph(
28 document.getElementById("g1"),
29 negs, { labels: [ 'x', 'y1', 'y2' ] }
30 );
31
32 new Dygraph(
33 document.getElementById("g2"),
34 mixed, { labels: [ 'x', 'y1', 'y2' ] }
35 );
36
37 new Dygraph(
38 document.getElementById("g3"),
39 pos, { labels: [ 'x', 'y1', 'y2' ] }
40 );
41 }
42 });