5 <script type=
"text/javascript" src=
"excanvas.js"></script>
7 <script type=
"text/javascript" src=
"../strftime/strftime-min.js"></script>
8 <script type=
"text/javascript" src=
"../rgbcolor/rgbcolor.js"></script>
9 <script type=
"text/javascript" src=
"../dygraph-canvas.js"></script>
10 <script type=
"text/javascript" src=
"../dygraph.js"></script>
13 <div id=
"div_g"></div>
15 <a href=
"#" onclick=
"zoom(3600)">hour
</a>
16 <a href=
"#" onclick=
"zoom(86400)">day
</a>
17 <a href=
"#" onclick=
"zoom(604800)">week
</a>
18 <a href=
"#" onclick=
"zoom(30 * 86400)">month
</a>
19 <a href=
"#" onclick=
"reset()">full
</a>
21 <a href=
"#" onclick=
"pan(-1)">left
</a>
22 <a href=
"#" onclick=
"pan(+1)">right
</a>
24 <script type=
"text/javascript">
26 var base_time = Date.parse(
"2008/07/01");
27 var num =
24 *
0.25 *
365;
28 for (var i =
0; i < num; i++) {
29 r.push([ new Date(base_time + i *
3600 *
1000),
30 i +
50 * (i %
60), // line
31 i * (num - i) *
4.0 / num // parabola
34 var orig_range = [ r[
0][
0].valueOf(), r[r.length -
1][
0].valueOf() ];
36 document.getElementById(
"div_g"),
42 labels: [
"Date",
"a",
"b"]
46 var desired_range = null;
47 function approach_range() {
48 if (!desired_range) return;
50 var range = g.xAxisRange();
51 if (Math.abs(desired_range[
0] - range[
0]) <
60 &&
52 Math.abs(desired_range[
1] - range[
1]) <
60) {
53 g.updateOptions({dateWindow: desired_range});
54 // (do not set another timeout.)
57 new_range = [
0.5 * (desired_range[
0] + range[
0]),
58 0.5 * (desired_range[
1] + range[
1])];
59 g.updateOptions({dateWindow: new_range});
64 setTimeout(approach_range,
50);
68 var w = g.xAxisRange();
69 desired_range = [ w[
0], w[
0] + res *
1000 ];
74 desired_range = orig_range;
79 var w = g.xAxisRange();
80 var scale = w[
1] - w[
0];
81 var amount = scale *
0.25 * dir;
82 desired_range = [ w[
0] + amount, w[
1] + amount ];