Merge pull request #303 from danvk/fix-hidpi
[dygraphs.git] / gallery / demo.js
CommitLineData
e88a95b4 1/*global Gallery,Dygraph,data */
c1f22b5a
RK
2Gallery.register(
3 'demo',
4 {
5 name: 'Interesting Shapes',
6 title: 'The original demo!',
7 setup: function(parent) {
8 parent.innerHTML =
9 "<span style='font-size: small;'>(Mouse over to highlight individual values. Click and drag to zoom. Double-click to zoom out.)</span><br/>" +
10 "<table><tr><td>" +
11 "<div id='demodiv'></div>" +
12 "</td><td valign=top>" +
13 "<div id='status' style='width:200px; font-size:0.8em; padding-top:5px;'></div>" +
14 "</td>" +
15 "</tr></table>";
16 },
17 run: function() {
e88a95b4 18 new Dygraph(
c1f22b5a
RK
19 document.getElementById("demodiv"),
20 function() {
21 var zp = function(x) { if (x < 10) return "0"+x; else return x; };
22 var r = "date,parabola,line,another line,sine wave\n";
23 for (var i=1; i<=31; i++) {
24 r += "200610" + zp(i);
25 r += "," + 10*(i*(31-i));
26 r += "," + 10*(8*i);
27 r += "," + 10*(250 - 8*i);
28 r += "," + 10*(125 + 125 * Math.sin(0.3*i));
29 r += "\n";
30 }
31 return r;
32 },
33 {
34 labelsDiv: document.getElementById('status'),
35 labelsSeparateLines: true,
36 labelsKMB: true,
37 legend: 'always',
38 colors: ["rgb(51,204,204)",
39 "rgb(255,100,100)",
40 "#00DD55",
41 "rgba(50,50,200,0.4)"],
42 width: 640,
43 height: 480,
44 title: 'Interesting Shapes',
45 xlabel: 'Date',
46 ylabel: 'Count',
47 axisLineColor: 'white',
48 drawXGrid: false
49 }
50 );
51 }
52 });