Commit | Line | Data |
---|---|---|
54425b14 | 1 | <!DOCTYPE html> |
a9fc39ab DV |
2 | <html> |
3 | <head> | |
4 | <title>Custom grid and Dot</title> | |
7e5ddc94 DV |
5 | <!-- |
6 | For production (minified) code, use: | |
7 | <script type="text/javascript" src="dygraph-combined.js"></script> | |
8 | --> | |
9 | <script type="text/javascript" src="../dygraph-dev.js"></script> | |
10 | ||
a9fc39ab DV |
11 | <script type="text/javascript" src="data.js"></script> |
12 | </head> | |
b8bd9b35 | 13 | |
a9fc39ab DV |
14 | <body> |
15 | <p>Dot and lines should be extra large. Grid is red.</p> | |
d16579a0 | 16 | <div id="div_g14" style="width:600px; height:300px;"></div> |
a9fc39ab DV |
17 | |
18 | <script type="text/javascript"> | |
285a6bda | 19 | g14 = new Dygraph( |
d16579a0 | 20 | document.getElementById("div_g14"), |
285a6bda | 21 | NoisyData, { |
a9fc39ab DV |
22 | rollPeriod: 14, |
23 | errorBars: true, | |
f2f24402 | 24 | gridLineColor: '#FF0000', |
a9fc39ab | 25 | highlightCircleSize: 10, |
f2f24402 | 26 | strokeWidth: 3 |
a9fc39ab DV |
27 | } |
28 | ); | |
29 | </script> | |
c866c1fe DE |
30 | |
31 | <p>Use axis specific grid options. (independentTicks, gridLinePattern, ...)</p> | |
32 | <div id="div_g15" style="width:600px; height:300px;"></div> | |
33 | ||
34 | <script type="text/javascript"> | |
35 | var data = []; | |
36 | for (var i = 1; i <= 100; i++) { | |
37 | var m = "01", d = i; | |
38 | if (d > 31) { m = "02"; d -= 31; } | |
39 | if (m == "02" && d > 28) { m = "03"; d -= 28; } | |
40 | if (m == "03" && d > 31) { m = "04"; d -= 31; } | |
41 | if (d < 10) d = "0" + d; | |
42 | // two series, one with range 1-100, one with range 1-2M | |
43 | data.push([new Date("2010/" + m + "/" + d), | |
44 | i, | |
45 | 100 - i, | |
46 | 1e6 * (1 + i * (100 - i) / (50 * 50)), | |
47 | 1e6 * (2 - i * (100 - i) / (50 * 50))]); | |
48 | } | |
49 | g15 = new Dygraph( | |
50 | document.getElementById("div_g15"), | |
51 | data, | |
52 | { | |
53 | labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ], | |
54 | series : { | |
55 | 'Y3': { | |
56 | axis: 'y2' | |
57 | }, | |
58 | 'Y4': { | |
59 | axis: 'y2' | |
60 | } | |
61 | }, | |
62 | axes: { | |
63 | x: { | |
64 | gridLineWidth: 2, | |
65 | drawGrid: true, | |
66 | independentTicks: true | |
67 | }, | |
68 | y: { | |
69 | valueRange: [40, 80], | |
70 | drawGrid: true, | |
71 | independentTicks: true | |
72 | }, | |
73 | y2: { | |
74 | // set axis-related properties here | |
75 | labelsKMB: true, | |
76 | ticker: Dygraph.numericLinearTicks, | |
77 | drawGrid: true, | |
78 | independentTicks: true, | |
79 | gridLineColor: "#ff0000", | |
80 | gridLinePattern: [4,4] | |
81 | } | |
82 | } | |
83 | } | |
84 | ); | |
85 | </script> | |
a9fc39ab | 86 | </body> |
2cfce1c8 | 87 | </html> |