4 <meta http-equiv=
"X-UA-Compatible" content=
"IE=EmulateIE7; IE=EmulateIE9">
7 <script type=
"text/javascript" src=
"../excanvas.js"></script>
10 For production (minified) code, use:
11 <script type=
"text/javascript" src=
"dygraph-combined.js"></script>
13 <script type=
"text/javascript" src=
"../dygraph-dev.js"></script>
17 <div id=
"div_g"></div>
19 <a href=
"#" onclick=
"zoom(3600)">hour
</a>
20 <a href=
"#" onclick=
"zoom(86400)">day
</a>
21 <a href=
"#" onclick=
"zoom(604800)">week
</a>
22 <a href=
"#" onclick=
"zoom(30 * 86400)">month
</a>
23 <a href=
"#" onclick=
"reset()">full
</a>
25 <a href=
"#" onclick=
"pan(-1)">left
</a>
26 <a href=
"#" onclick=
"pan(+1)">right
</a>
28 <script type=
"text/javascript">
30 var base_time = Date.parse(
"2008/07/01");
31 var num =
24 *
0.25 *
365;
32 for (var i =
0; i < num; i++) {
33 r.push([ new Date(base_time + i *
3600 *
1000),
34 i +
50 * (i %
60), // line
35 i * (num - i) *
4.0 / num // parabola
38 var orig_range = [ r[
0][
0].valueOf(), r[r.length -
1][
0].valueOf() ];
40 document.getElementById(
"div_g"),
46 labels: [
"Date",
"a",
"b"]
50 var desired_range = null;
51 function approach_range() {
52 if (!desired_range) return;
54 var range = g.xAxisRange();
55 if (Math.abs(desired_range[
0] - range[
0]) <
60 &&
56 Math.abs(desired_range[
1] - range[
1]) <
60) {
57 g.updateOptions({dateWindow: desired_range});
58 // (do not set another timeout.)
61 new_range = [
0.5 * (desired_range[
0] + range[
0]),
62 0.5 * (desired_range[
1] + range[
1])];
63 g.updateOptions({dateWindow: new_range});
68 setTimeout(approach_range,
50);
72 var w = g.xAxisRange();
73 desired_range = [ w[
0], w[
0] + res *
1000 ];
78 desired_range = orig_range;
83 var w = g.xAxisRange();
84 var scale = w[
1] - w[
0];
85 var amount = scale *
0.25 * dir;
86 desired_range = [ w[
0] + amount, w[
1] + amount ];