REFACTORING: adapted EOL
[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 'parabola': {
74 strokePattern: null,
75 drawPoints: true,
76 pointSize: 4,
77 highlightCircleSize: 6
78 },
79 'line': {
80 strokePattern: Dygraph.DASHED_LINE,
81 strokeWidth: 1.0,
82 drawPoints: true,
83 pointSize: 1.5
84 },
85 'another line': {
86 strokePattern: [25, 5]
87 },
88 'sine wave': {
89 strokePattern: Dygraph.DOTTED_LINE,
90 strokeWidth: 3,
91 highlightCircleSize: 10
92 },
93 'sine wave2': {
94 strokePattern: Dygraph.DOT_DASH_LINE,
95 strokeWidth: 2,
96 highlightCircleSize: 3
97 }
98 }
99 );
100 g3 = new Dygraph(
101 document.getElementById("demodiv3"),
102 data,
103 {
104 strokeWidth: 2,
105 'parabola': {
106 strokeWidth: 0.0,
107 drawPoints: true,
108 pointSize: 4,
109 highlightCircleSize: 6
110 },
111 'line': {
112 strokeWidth: 1.0,
113 drawPoints: true,
114 pointSize: 1.5
115 },
116 'sine wave': {
117 strokeWidth: 3,
118 highlightCircleSize: 10
119 },
120 'sine wave2': {
121 strokePattern: [10, 2, 5, 2],
122 strokeWidth: 2,
123 highlightCircleSize: 3
124 }
125 }
126 );
127
128 </script>
129 </body>
130 </html>