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