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