Skip to content

Commit

Permalink
Fixed issue with input range where the range would be reset based on …
Browse files Browse the repository at this point in the history
…wrong extremes. Ref #5602.
  • Loading branch information
oysteinmoseng authored and TorsteinHonsi committed Oct 19, 2016
1 parent afb483e commit 4ab11d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/parts/RangeSelector.js
Expand Up @@ -465,9 +465,10 @@ RangeSelector.prototype = {
function updateExtremes() {
var inputValue = input.value,
value = (options.inputDateParser || Date.parse)(inputValue),
xAxis = chart.scroller && chart.scroller.xAxis ? chart.scroller.xAxis : chart.xAxis[0],
dataMin = xAxis.dataMin,
dataMax = xAxis.dataMax;
chartAxis = chart.xAxis[0],
dataAxis = chart.scroller && chart.scroller.xAxis ? chart.scroller.xAxis : chartAxis,
dataMin = dataAxis.dataMin,
dataMax = dataAxis.dataMax;
if (value !== input.previousValue) {
input.previousValue = value;
// If the value isn't parsed directly to a value by the browser's Date.parse method,
Expand Down Expand Up @@ -502,9 +503,9 @@ RangeSelector.prototype = {

// Set the extremes
if (value !== undefined) {
chart.xAxis[0].setExtremes(
isMin ? value : xAxis.min,
isMin ? xAxis.max : value,
chartAxis.setExtremes(
isMin ? value : chartAxis.min,
isMin ? chartAxis.max : value,
undefined,
undefined,
{ trigger: 'rangeSelectorInput' }
Expand Down
5 changes: 5 additions & 0 deletions samples/unit-tests/rangeselector/input-range/demo.details
@@ -0,0 +1,5 @@
---
resources:
- https://code.jquery.com/qunit/qunit-1.19.0.js
- https://code.jquery.com/qunit/qunit-1.19.0.css
...
6 changes: 6 additions & 0 deletions samples/unit-tests/rangeselector/input-range/demo.html
@@ -0,0 +1,6 @@
<script src="https://code.highcharts.com/stock/highstock.js"></script>

<div id="qunit"></div>
<div id="qunit-fixture"></div>

<div id="container" style="width: 600px; margin: 0 auto"></div>

0 comments on commit 4ab11d6

Please sign in to comment.