X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=tests%2Finteraction.html;fp=tests%2Finteraction.html;h=58f3dac25dbdfc6896175102300275e4fa64aca0;hb=027e9e9b363e2330191001068818089477345b75;hp=8389ae7ba1a64a9420ce8e9b7375cf94e8b6ed55;hpb=36d73927ffdd7b345a1ff1700473223b53fd5a63;p=dygraphs.git diff --git a/tests/interaction.html b/tests/interaction.html index 8389ae7..58f3dac 100644 --- a/tests/interaction.html +++ b/tests/interaction.html @@ -25,7 +25,9 @@ No interaction model
- Click and drag all you like, it won't do anything! + Click and drag all you like, it won't do anything! +
+ Custom interaction model @@ -53,8 +55,19 @@ Dygraph.addEvent(document, "click", function() { lastClickedGraph = null; }); var g = new Dygraph(document.getElementById("div_g"), NoisyData, { errorBars : true }); + var s = document.getElementById("g2_console"); var g2 = new Dygraph(document.getElementById("div_g2"), - NoisyData, { errorBars : true, interactionModel : {} }); + NoisyData, + { + errorBars : true, + interactionModel: Dygraph.Interaction.nonInteractiveModel, + clickCallback: function(e, x, pts) { + s.innerHTML += "Click " + pts[0].name + ": " + pts[0].x + "
"; + }, + pointClickCallback: function(e, p) { + s.innerHTML += "Point Click " + p.name + ": " + p.x + "
"; + }, + }); var g3 = new Dygraph(document.getElementById("div_g3"), NoisyData, { errorBars : true, interactionModel : { 'mousedown' : downV3,