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