5 <script type=
"text/javascript" src=
"excanvas.js"></script>
7 <script type=
"text/javascript" src=
"../dygraph-combined.js"></script>
8 <script type=
"text/javascript" src=
"../dygraph-canvas.js"></script>
9 <script type=
"text/javascript" src=
"../dygraph.js"></script>
12 <div id=
"div_g"></div>
14 <a href=
"#" onclick=
"zoom(3600)">hour
</a>
15 <a href=
"#" onclick=
"zoom(86400)">day
</a>
16 <a href=
"#" onclick=
"zoom(604800)">week
</a>
17 <a href=
"#" onclick=
"zoom(30 * 86400)">month
</a>
18 <a href=
"#" onclick=
"reset()">full
</a>
20 <a href=
"#" onclick=
"pan(-1)">left
</a>
21 <a href=
"#" onclick=
"pan(+1)">right
</a>
23 <script type=
"text/javascript">
25 var base_time = Date.parse(
"2008/07/01");
26 var num =
24 *
0.25 *
365;
27 for (var i =
0; i < num; i++) {
28 r.push([ new Date(base_time + i *
3600 *
1000),
29 i +
50 * (i %
60), // line
30 i * (num - i) *
4.0 / num // parabola
33 var orig_range = [ r[
0][
0].valueOf(), r[r.length -
1][
0].valueOf() ];
35 document.getElementById(
"div_g"),
41 labels: [
"Date",
"a",
"b"]
45 var desired_range = null;
46 function approach_range() {
47 if (!desired_range) return;
49 var range = g.xAxisRange();
50 if (Math.abs(desired_range[
0] - range[
0]) <
60 &&
51 Math.abs(desired_range[
1] - range[
1]) <
60) {
52 g.updateOptions({dateWindow: desired_range});
53 // (do not set another timeout.)
56 new_range = [
0.5 * (desired_range[
0] + range[
0]),
57 0.5 * (desired_range[
1] + range[
1])];
58 g.updateOptions({dateWindow: new_range});
63 setTimeout(approach_range,
50);
67 var w = g.xAxisRange();
68 desired_range = [ w[
0], w[
0] + res *
1000 ];
73 desired_range = orig_range;
78 var w = g.xAxisRange();
79 var scale = w[
1] - w[
0];
80 var amount = scale *
0.25 * dir;
81 desired_range = [ w[
0] + amount, w[
1] + amount ];