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"),
47 labels: [
"Date",
"a",
"b"]
51 var desired_range = null;
52 function approach_range() {
53 if (!desired_range) return;
55 var range = g.xAxisRange();
56 if (Math.abs(desired_range[
0] - range[
0]) <
60 &&
57 Math.abs(desired_range[
1] - range[
1]) <
60) {
58 g.updateOptions({dateWindow: desired_range});
59 // (do not set another timeout.)
62 new_range = [
0.5 * (desired_range[
0] + range[
0]),
63 0.5 * (desired_range[
1] + range[
1])];
64 g.updateOptions({dateWindow: new_range});
69 setTimeout(approach_range,
50);
73 var w = g.xAxisRange();
74 desired_range = [ w[
0], w[
0] + res *
1000 ];
79 desired_range = orig_range;
84 var w = g.xAxisRange();
85 var scale = w[
1] - w[
0];
86 var amount = scale *
0.25 * dir;
87 desired_range = [ w[
0] + amount, w[
1] + amount ];