Set this for drawCallback
[dygraphs.git] / tests / grid_dot.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Custom grid and Dot</title>
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
11 <script type="text/javascript" src="data.js"></script>
12 </head>
13
14 <body>
15 <p>Dot and lines should be extra large. Grid is red.</p>
16 <div id="div_g14" style="width:600px; height:300px;"></div>
17
18 <script type="text/javascript">
19 g14 = new Dygraph(
20 document.getElementById("div_g14"),
21 NoisyData, {
22 rollPeriod: 14,
23 errorBars: true,
24 gridLineColor: '#FF0000',
25 highlightCircleSize: 10,
26 strokeWidth: 3
27 }
28 );
29 </script>
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>
86 </body>
87 </html>