X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=gallery%2Finteraction.js;h=5936189f363d78dea5ef2c69623a3f70288d98ba;hb=refs%2Fheads%2Fissue-524;hp=69a812cdb8b6e9ec44e6210b2a24df21c85a1468;hpb=56f64289bdbd75dea1ee58faf529d39465d11008;p=dygraphs.git
diff --git a/gallery/interaction.js b/gallery/interaction.js
index 69a812c..5936189 100644
--- a/gallery/interaction.js
+++ b/gallery/interaction.js
@@ -1,3 +1,6 @@
+/*global Gallery,Dygraph,data */
+/*global NoisyData,downV3,moveV3,upV3,clickV3,dblClickV3,scrollV3,restorePositioning,downV4,moveV4,upV4,dblClickV4,captureCanvas */
+
Gallery.register(
'interaction',
{
@@ -5,7 +8,7 @@ Gallery.register(
title: 'title',
setup: function(parent) {
parent.innerHTML = [
- "
Default interaction model
",
+ "Default interaction model
",
"",
"
",
" Zoom: click-drag, Pan: shift-click-drag, Restore: double-click",
@@ -13,7 +16,7 @@ Gallery.register(
"
",
"
",
"",
- "Empty interaction model
",
+ "Empty interaction model
",
"",
"
",
" Click and drag all you like, it won't do anything!",
@@ -22,7 +25,7 @@ Gallery.register(
"
",
"", // what is this?
"",
- "Custom interaction model
",
+ "Custom interaction model
",
"",
"
",
" Zoom in: double-click, scroll wheel
",
@@ -34,25 +37,25 @@ Gallery.register(
" ",
"
",
"
",
- "Fun model!
",
+ "Fun model!
",
"",
"
",
" Keep the mouse button pressed, and hover over all points",
" to mark them.",
"
",
"
",
- "
",
+ ""
].join('\n');
},
run: function() {
+ var lastClickedGraph;
// TODO(konigsberg): Add cleanup to remove callbacks.
Dygraph.addEvent(document, "mousewheel", function() { lastClickedGraph = null; });
Dygraph.addEvent(document, "click", function() { lastClickedGraph = null; });
- var g = new Dygraph(document.getElementById("div_g"),
+ new Dygraph(document.getElementById("div_g"),
NoisyData, { errorBars : true });
- var s = document.getElementById("g2_console");
- var g2 = new Dygraph(document.getElementById("div_g2"),
+ new Dygraph(document.getElementById("div_g2"),
NoisyData,
{
errorBars : true,
@@ -69,15 +72,18 @@ Gallery.register(
}});
document.getElementById("restore3").onclick = function() {
restorePositioning(g3);
- }
- var g4 = new Dygraph(document.getElementById("div_g4"),
- NoisyData, { errorBars : true, drawPoints : true, interactionModel : {
- 'mousedown' : downV4,
- 'mousemove' : moveV4,
- 'mouseup' : upV4,
- 'dblclick' : dblClickV4,
- },
- underlayCallback : captureCanvas
- });
+ };
+ new Dygraph(document.getElementById("div_g4"),
+ NoisyData, {
+ errorBars : true,
+ drawPoints : true,
+ interactionModel : {
+ 'mousedown' : downV4,
+ 'mousemove' : moveV4,
+ 'mouseup' : upV4,
+ 'dblclick' : dblClickV4
+ },
+ underlayCallback : captureCanvas
+ });
}
});