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