Merge
[dygraphs.git] / tests / per-series.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
5 <title>Per-Series Properties</title>
6 <!--[if IE]>
7 <script type="text/javascript" src="../excanvas.js"></script>
8 <![endif]-->
9 <!--
10 For production (minified) code, use:
11 <script type="text/javascript" src="dygraph-combined.js"></script>
12 -->
13 <script type="text/javascript" src="../dygraph-dev.js"></script>
14
15 </head>
16 <body>
17 <h2>Chart with per-series properties</h2>
18 <div id="demodiv"></div>
19 <h2>Chart with per-series properties with legend.</h2>
20 <div id="demodiv2"></div>
21 <h2>First graph, using old-style series specification.</h2>
22 <div id="demodiv3"></div>
23 <script type="text/javascript">
24 data = function() {
25 var zp = function(x) { if (x < 10) return "0"+x; else return x; };
26 var r = "date,parabola,line,another line,sine wave,sine wave2\n";
27 for (var i=1; i<=31; i++) {
28 r += "200610" + zp(i);
29 r += "," + 10*(i*(31-i));
30 r += "," + 10*(8*i);
31 r += "," + 10*(250 - 8*i);
32 r += "," + 10*(125 + 125 * Math.sin(0.3*i));
33 r += "," + 10*(125 + 125 * Math.sin(0.3*i+Math.PI));
34 r += "\n";
35 }
36 return r;
37 };
38 g = new Dygraph(
39 document.getElementById("demodiv"),
40 data,
41 {
42 strokeWidth: 2,
43 series : {
44 'parabola': {
45 strokeWidth: 0.0,
46 drawPoints: true,
47 pointSize: 4,
48 highlightCircleSize: 6
49 },
50 'line': {
51 strokeWidth: 1.0,
52 drawPoints: true,
53 pointSize: 1.5
54 },
55 'sine wave': {
56 strokeWidth: 3,
57 highlightCircleSize: 10
58 },
59 'sine wave2': {
60 strokePattern: [10, 2, 5, 2],
61 strokeWidth: 2,
62 highlightCircleSize: 3
63 }
64 }
65 }
66 );
67 g2 = new Dygraph(
68 document.getElementById("demodiv2"),
69 data,
70 {
71 legend: 'always',
72 strokeWidth: 2,
73 series: {
74 'parabola': {
75 strokePattern: null,
76 drawPoints: true,
77 pointSize: 4,
78 highlightCircleSize: 6
79 },
80 'line': {
81 strokePattern: Dygraph.DASHED_LINE,
82 strokeWidth: 1.0,
83 drawPoints: true,
84 pointSize: 1.5
85 },
86 'another line': {
87 strokePattern: [25, 5]
88 },
89 'sine wave': {
90 strokePattern: Dygraph.DOTTED_LINE,
91 strokeWidth: 3,
92 highlightCircleSize: 10
93 },
94 'sine wave2': {
95 strokePattern: Dygraph.DOT_DASH_LINE,
96 strokeWidth: 2,
97 highlightCircleSize: 3
98 }
99 }
100 }
101 );
102 g3 = new Dygraph(
103 document.getElementById("demodiv3"),
104 data,
105 {
106 strokeWidth: 2,
107 series: {
108 'parabola': {
109 strokeWidth: 0.0,
110 drawPoints: true,
111 pointSize: 4,
112 highlightCircleSize: 6
113 },
114 'line': {
115 strokeWidth: 1.0,
116 drawPoints: true,
117 pointSize: 1.5
118 },
119 'sine wave': {
120 strokeWidth: 3,
121 highlightCircleSize: 10
122 },
123 'sine wave2': {
124 strokePattern: [10, 2, 5, 2],
125 strokeWidth: 2,
126 highlightCircleSize: 3
127 }
128 }
129 }
130 );
131
132 </script>
133 </body>
134 </html>