Bug fix for dygraph point selection touch event.
[dygraphs.git] / tests / connect-separated.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="stylesheet" href="../dist/dygraph.css">
5 <title>connect separated</title>
6 <script type="text/javascript" src="../dist/dygraph.js"></script>
7
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>
13
14 <div id="graphdiv" style="width:600px; height:300px;"></div>
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>
22 <script type="text/javascript">
23 var g = new Dygraph(document.getElementById("graphdiv"),
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],
30 [ new Date("2009/12/06"), 18, null, null],
31 [ new Date("2009/12/07"), 12, 14, null]
32 ],
33 {
34 connectSeparatedPoints: true,
35 labels: ["Date","Series1","Series2","Series3"]
36 });
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
47 if (el.id == "All") {
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 }
58 </script>
59 </body>
60 </html>