From 6feb37827974970b8bdcf8797a12d757d54116cc Mon Sep 17 00:00:00 2001 From: Gordon Woodhull Date: Thu, 4 Aug 2016 19:43:50 -0400 Subject: [PATCH] rotate through a few more spans to display the off-edge bug #949 --- web/transitions/bar-transitions.html | 8 +++++++- web/transitions/transition-test.js | 12 ++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/web/transitions/bar-transitions.html b/web/transitions/bar-transitions.html index fee535669..4e345bdab 100644 --- a/web/transitions/bar-transitions.html +++ b/web/transitions/bar-transitions.html @@ -60,7 +60,13 @@ chart.x().domain([16,20]); }, reset); window.button3 = transitionTest.oscillate(function() { - chart.x().domain([6,14]); + chart.x().domain([6.5,13.5]); + }, function() { + chart.x().domain([4.25,9.5]); + }, function() { + chart.x().domain([11.5,17.25]); + }, function() { + chart.x().domain([8.25,13.25]); }, reset); window.button4 = transitionTest.oscillate(function() { chart.x().domain([0,10]); diff --git a/web/transitions/transition-test.js b/web/transitions/transition-test.js index fe25dd8f4..2ac25f7c6 100644 --- a/web/transitions/transition-test.js +++ b/web/transitions/transition-test.js @@ -22,17 +22,17 @@ var transitionTest = (function() { window.clearInterval(inter); inter = null; } - function oscillate(f1, f2) { + function oscillate() { + var fs = Array.prototype.slice.apply(arguments); + var curr = 0; return function() { stop(); var which = false; - f1(); + fs[curr](); dc.redrawAll(); inter = window.setInterval(function() { - if((which = !which)) - f2(); - else - f1(); + curr = (curr+1) % fs.length; + fs[curr](); dc.redrawAll(); }, duration+pause); };