Commit | Line | Data |
---|---|---|
54425b14 | 1 | <!DOCTYPE html> |
563c70ca AV |
2 | <html> |
3 | <head> | |
fd6b8dad | 4 | <link rel="stylesheet" href="../dist/dygraph.css"> |
563c70ca | 5 | <title>connect separated</title> |
fbd6834a | 6 | <script type="text/javascript" src="../dist/dygraph.js"></script> |
7e5ddc94 | 7 | |
563c70ca AV |
8 | </head> |
9 | <body> | |
10 | <p>Connecting separated points. All three of the series should have their points | |
11 | connected with lines, and hovering over them should produce dot and legend | |
12 | overlays in the proper color.</p> | |
67b65269 | 13 | |
563c70ca | 14 | <div id="graphdiv" style="width:600px; height:300px;"></div> |
b85358e2 RK |
15 | <p><b>Toggle ConnectSeparated:<b></p> |
16 | <p> | |
17 | All: <button id="All" onclick="change(this)">true</button> | |
18 | Series 1 <button id="Series1" onclick="change(this)">disabled</button> | |
19 | Series 2 <button id="Series2" onclick="change(this)">disabled</button> | |
20 | Series 3 <button id="Series3" onclick="change(this)">disabled</button> | |
21 | </p> | |
563c70ca | 22 | <script type="text/javascript"> |
f6fbf9e0 | 23 | var g = new Dygraph(document.getElementById("graphdiv"), |
563c70ca AV |
24 | [ |
25 | [ new Date("2009/12/01"), 10, 10, 10], | |
26 | [ new Date("2009/12/02"), 15, 11, 12], | |
27 | [ new Date("2009/12/03"), null, null, 12], | |
28 | [ new Date("2009/12/04"), 20, 14, null], | |
29 | [ new Date("2009/12/05"), 15, null, 17], | |
0209e56f AV |
30 | [ new Date("2009/12/06"), 18, null, null], |
31 | [ new Date("2009/12/07"), 12, 14, null] | |
563c70ca AV |
32 | ], |
33 | { | |
34 | connectSeparatedPoints: true, | |
31b1e394 | 35 | labels: ["Date","Series1","Series2","Series3"] |
563c70ca | 36 | }); |
b85358e2 RK |
37 | |
38 | function change(el) { | |
39 | var textSequences = [ "disabled", "true", "false" ]; | |
40 | var values = [ null, true, false ]; | |
41 | for (var idx = 0; idx < textSequences.length; idx++) { | |
42 | if (textSequences[idx] == el.textContent) { | |
43 | var nextIdx = (idx + 1) % 3; | |
44 | var nextVal = values[nextIdx]; | |
45 | el.textContent = textSequences[nextIdx]; | |
46 | ||
7e64db42 | 47 | if (el.id == "All") { |
b85358e2 RK |
48 | g.updateOptions({ connectSeparatedPoints : nextVal }); |
49 | } else { | |
50 | var seriesOpt = {}; | |
51 | seriesOpt[el.id] = { connectSeparatedPoints : nextVal }; | |
52 | g.updateOptions({ series : seriesOpt }); | |
53 | } | |
54 | break; | |
55 | } | |
56 | } | |
57 | } | |
563c70ca AV |
58 | </script> |
59 | </body> | |
60 | </html> |