Merge pull request #178 from kberg/tests
[dygraphs.git] / gallery / per-series.js
1 Gallery.register(
2 'per-series',
3 {
4 name: 'Per-series properties',
5 title: 'Chart with per-series properties',
6 setup: function(parent) {
7 parent.innerHTML = "<div id='demodiv'>";
8 },
9 run: function() {
10 g = new Dygraph(
11 document.getElementById("demodiv"),
12 function() {
13 var zp = function(x) { if (x < 10) return "0"+x; else return x; };
14 var r = "date,parabola,line,another line,sine wave\n";
15 for (var i=1; i<=31; i++) {
16 r += "200610" + zp(i);
17 r += "," + 10*(i*(31-i));
18 r += "," + 10*(8*i);
19 r += "," + 10*(250 - 8*i);
20 r += "," + 10*(125 + 125 * Math.sin(0.3*i));
21 r += "\n";
22 }
23 return r;
24 },
25 {
26 strokeWidth: 2,
27 'parabola': {
28 strokeWidth: 0.0,
29 drawPoints: true,
30 pointSize: 4,
31 highlightCircleSize: 6
32 },
33 'line': {
34 strokeWidth: 1.0,
35 drawPoints: true,
36 pointSize: 1.5
37 },
38 'sine wave': {
39 strokeWidth: 3,
40 highlightCircleSize: 10
41 }
42 }
43 );
44 }
45 });