diff --git a/src/extras/synchronizer.js b/src/extras/synchronizer.js index 2b8bb749..0650118b 100644 --- a/src/extras/synchronizer.js +++ b/src/extras/synchronizer.js @@ -158,11 +158,8 @@ var synchronize = function(/* dygraphs..., opts */) { }; }; -function arraysAreEqualOrBothNULL(a, b) { - if (a === null && b === null) - return true; - if (!Array.isArray(a) || !Array.isArray(b)) - return false; +function arraysAreEqual(a, b) { + if (!Array.isArray(a) || !Array.isArray(b)) return false; var i = a.length; if (i !== b.length) return false; while (i--) { @@ -180,9 +177,9 @@ function attachZoomHandlers(gs, syncOpts, prevCallbacks) { if (block || initial) return; block = true; var opts = { - valueRange: syncOpts.range ? me.yAxisRange() : null, dateWindow: me.xAxisRange() }; + if (syncOpts.range) opts.valueRange = me.yAxisRange(); for (var j = 0; j < gs.length; j++) { if (gs[j] == me) { @@ -193,8 +190,8 @@ function attachZoomHandlers(gs, syncOpts, prevCallbacks) { } // Only redraw if there are new options - if (arraysAreEqualOrBothNULL(opts.dateWindow, gs[j].getOption('dateWindow')) && - arraysAreEqualOrBothNULL(opts.valueRange, gs[j].getOption('valueRange'))) { + if (arraysAreEqual(opts.dateWindow, gs[j].getOption('dateWindow')) && + arraysAreEqual(opts.valueRange, gs[j].getOption('valueRange'))) { continue; }