projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #625 from kkirsche/patch-1
[dygraphs.git]
/
gallery
/
link-interaction.js
diff --git
a/gallery/link-interaction.js
b/gallery/link-interaction.js
index
f0bfecf
..
68177a3
100644
(file)
--- a/
gallery/link-interaction.js
+++ b/
gallery/link-interaction.js
@@
-1,4
+1,4
@@
-/
/ Use this as a template for new Gallery entries.
+/
*global Gallery,Dygraph,data */
Gallery.register(
'link-interaction',
{
Gallery.register(
'link-interaction',
{
@@
-27,7
+27,7
@@
Gallery.register(
]);
}
var orig_range = [ r[0][0].valueOf(), r[r.length - 1][0].valueOf() ];
]);
}
var orig_range = [ r[0][0].valueOf(), r[r.length - 1][0].valueOf() ];
- g = new Dygraph(
+
var
g = new Dygraph(
document.getElementById("div_g"),
r, {
rollPeriod: 7,
document.getElementById("div_g"),
r, {
rollPeriod: 7,
@@
-39,7
+39,7
@@
Gallery.register(
}
);
}
);
- var desired_range = null;
+ var desired_range = null
, animate
;
function approach_range() {
if (!desired_range) return;
// go halfway there
function approach_range() {
if (!desired_range) return;
// go halfway there
@@
-56,20
+56,20
@@
Gallery.register(
animate();
}
}
animate();
}
}
-
function animate
() {
+
animate = function
() {
setTimeout(approach_range, 50);
setTimeout(approach_range, 50);
- }
+ }
;
var zoom = function(res) {
var w = g.xAxisRange();
desired_range = [ w[0], w[0] + res * 1000 ];
animate();
var zoom = function(res) {
var w = g.xAxisRange();
desired_range = [ w[0], w[0] + res * 1000 ];
animate();
- }
+ }
;
var reset = function() {
desired_range = orig_range;
animate();
var reset = function() {
desired_range = orig_range;
animate();
- }
+ }
;
var pan = function(dir) {
var w = g.xAxisRange();
var pan = function(dir) {
var w = g.xAxisRange();
@@
-77,7
+77,7
@@
Gallery.register(
var amount = scale * 0.25 * dir;
desired_range = [ w[0] + amount, w[1] + amount ];
animate();
var amount = scale * 0.25 * dir;
desired_range = [ w[0] + amount, w[1] + amount ];
animate();
- }
+ }
;
document.getElementById('hour').onclick = function() { zoom(3600); };
document.getElementById('day').onclick = function() { zoom(86400); };
document.getElementById('hour').onclick = function() { zoom(3600); };
document.getElementById('day').onclick = function() { zoom(86400); };
@@
-87,4
+87,4
@@
Gallery.register(
document.getElementById('left').onclick = function() { pan(-1); };
document.getElementById('right').onclick = function() { pan(+1); };
}
document.getElementById('left').onclick = function() { pan(-1); };
document.getElementById('right').onclick = function() { pan(+1); };
}
- });
\ No newline at end of file
+ });