Skip to content

Instantly share code, notes, and snippets.

@TorsteinHonsi
Created May 24, 2016 08:11
Show Gist options
  • Save TorsteinHonsi/9d7b004351d8574e979ab76200d0b6d1 to your computer and use it in GitHub Desktop.
Save TorsteinHonsi/9d7b004351d8574e979ab76200d0b6d1 to your computer and use it in GitHub Desktop.
diff --git a/js/parts/Scroller.js b/js/parts/Scroller.js
index c96ae0a..4a3515f 100644
--- a/js/parts/Scroller.js
+++ b/js/parts/Scroller.js
@@ -867,13 +867,20 @@ Navigator.prototype = {
baseDataMin = baseExtremes.dataMin,
baseDataMax = baseExtremes.dataMax,
range = baseMax - baseMin,
- stickToMin = this.stickToMin,
- stickToMax = this.stickToMax,
+ stickToMin,
+ stickToMax,
newMax,
newMin,
navigatorSeries = this.series,
hasSetExtremes = !!baseXAxis.setExtremes;
+ // Detect whether the zoomed area should stick to the minimum or maximum. If the current
+ // axis minimum falls outside the new updated dataset, we must adjust.
+ stickToMin = baseSeries.xAxis.min <= baseSeries.xData[0];
+ // If the scrollbar is scrolled all the way to the right, keep right as new data
+ // comes in.
+ stickToMax = this.zoomedMax >= this.navigatorWidth;
+
// If the zoomed range is already at the min, move it to the right as new data
// comes in
if (stickToMin) {
@@ -897,9 +904,6 @@ Navigator.prototype = {
baseXAxis.max = baseXAxis.userMax = newMax;
}
}
-
- // Reset
- this.stickToMin = this.stickToMax = null;
},
/**
@@ -912,13 +916,6 @@ Navigator.prototype = {
baseSeries = scroller.baseSeries,
navigatorSeries = scroller.series;
- // Detect whether the zoomed area should stick to the minimum or maximum. If the current
- // axis minimum falls outside the new updated dataset, we must adjust.
- scroller.stickToMin = baseSeries.xAxis.min <= baseSeries.xData[0];
- // If the scrollbar is scrolled all the way to the right, keep right as new data
- // comes in.
- scroller.stickToMax = scroller.zoomedMax >= scroller.navigatorWidth;
-
// Set the navigator series data to the new data of the base series
if (navigatorSeries && !scroller.hasNavigatorData) {
navigatorSeries.options.pointStart = baseSeries.xData[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment