Commit | Line | Data |
---|---|---|
250bb62b PS |
1 | <!DOCTYPE html> |
2 | <html> | |
3 | <head> | |
93a5bb4c | 4 | <link rel="stylesheet" href="../css/dygraph.css"> |
250bb62b | 5 | <title>Label styles</title> |
250bb62b PS |
6 | <!-- |
7 | For production (minified) code, use: | |
8 | <script type="text/javascript" src="dygraph-combined.js"></script> | |
9 | --> | |
fbd6834a | 10 | <script type="text/javascript" src="../dist/dygraph.js"></script> |
250bb62b PS |
11 | |
12 | <script type="text/javascript" src="data.js"></script> | |
11ce506e PS |
13 | <style type="text/css"> |
14 | .dygraph-legend { | |
15 | background-color: rgba(200, 200, 255, 0.75) !important; | |
16 | padding: 4px; | |
17 | border: 1px solid #000; | |
18 | border-radius: 10px; | |
19 | box-shadow: 4px 4px 4px #888; | |
20 | pointer-events: none; | |
93a5bb4c | 21 | width: 100px; |
11ce506e | 22 | } |
c08d4ce2 DV |
23 | pre { |
24 | margin-top: 30px; | |
25 | } | |
11ce506e | 26 | </style> |
250bb62b PS |
27 | </head> |
28 | <body> | |
c08d4ce2 DV |
29 | <p>This page demonstrates different values for the <code><a href="http://dygraphs.com/options.html#legend">legend</a></code> option. Mouse over the charts to see the different behaviors.</p> |
30 | <pre>legend: "follow":</pre> | |
31 | <div id="follow" style="width:600px; height:300px;"></div> | |
32 | ||
33 | <pre>legend: "always":</pre> | |
34 | <div id="always" style="width:600px; height:300px;"></div> | |
35 | ||
36 | <pre>legend: "never":</pre> | |
37 | <div id="never" style="width:600px; height:300px;"></div> | |
38 | ||
39 | <pre>legend: "onmouseover" (the default):</pre> | |
40 | <div id="default" style="width:600px; height:300px;"></div> | |
250bb62b PS |
41 | |
42 | <script type="text/javascript"> | |
c08d4ce2 DV |
43 | function extend(obj1, obj2) { |
44 | var obj = {}; | |
45 | for (var k in obj1) { | |
46 | obj[k] = obj1[k]; | |
47 | } | |
48 | for (var k in obj2) { | |
49 | obj[k] = obj2[k]; | |
50 | } | |
51 | return obj; | |
52 | } | |
53 | ||
54 | var baseOpts = { | |
55 | rollPeriod: 14, | |
56 | errorBars: true, | |
c08d4ce2 DV |
57 | labelsSeparateLines: true |
58 | }; | |
59 | ||
60 | g_follow = new Dygraph( | |
61 | document.getElementById('follow'), | |
62 | NoisyData, | |
63 | extend(baseOpts, {legend: 'follow'})); | |
64 | ||
65 | g_always = new Dygraph( | |
66 | document.getElementById('always'), | |
67 | NoisyData, | |
68 | extend(baseOpts, {legend: 'always'})); | |
69 | ||
70 | g_never = new Dygraph( | |
71 | document.getElementById('never'), | |
72 | NoisyData, | |
73 | extend(baseOpts, {legend: 'never'})); | |
74 | ||
75 | g_default = new Dygraph( | |
76 | document.getElementById('default'), | |
77 | NoisyData, | |
78 | baseOpts); | |
79 | ||
250bb62b PS |
80 | </script> |
81 | </body> | |
82 | </html> |