| 1 | /*global Gallery,Dygraph,data */ |
| 2 | Gallery.register( |
| 3 | 'dygraph-simple', |
| 4 | { |
| 5 | name: 'Minimal Example', |
| 6 | setup: function(parent) { |
| 7 | parent.innerHTML = "<p>Minimal example of a dygraph chart:</p><div id='graphdiv'></div>" + |
| 8 | "<p>Same data, specified in a parsed format:</p><div id='graphdiv2'></div>"; |
| 9 | }, |
| 10 | run: function() { |
| 11 | new Dygraph(document.getElementById("graphdiv"), |
| 12 | "Date,Temperature\n" + |
| 13 | "2008-05-07,75\n" + |
| 14 | "2008-05-08,70\n" + |
| 15 | "2008-05-09,80\n"); |
| 16 | new Dygraph(document.getElementById("graphdiv2"), |
| 17 | [ [ new Date("2008/05/07"), 75], |
| 18 | [ new Date("2008/05/08"), 70], |
| 19 | [ new Date("2008/05/09"), 80] |
| 20 | ], |
| 21 | { |
| 22 | labels: [ "Date", "Temperature" ] |
| 23 | }); |
| 24 | } |
| 25 | }); |