Skip to content

Commit

Permalink
[axis] Fix #4097 (enable min/max to be set as Date when using time axis)
Browse files Browse the repository at this point in the history
  • Loading branch information
100pah committed Oct 18, 2016
1 parent a554e8c commit 3ddf66f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/coord/axisModelZoomMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ define(function (require) {
*/
getMin: function () {
var option = this.option;
return option.rangeStart != null ? option.rangeStart : option.min;
var min = option.rangeStart != null ? option.rangeStart : option.min;
// In case of axis.type === 'time', Date should be converted to timestamp.
// In other cases, min/max should be a number or null/undefined.
if (min != null) {
min = +min;
}
return min;
},

/**
Expand All @@ -17,7 +23,13 @@ define(function (require) {
*/
getMax: function () {
var option = this.option;
return option.rangeEnd != null ? option.rangeEnd : option.max;
var max = option.rangeEnd != null ? option.rangeEnd : option.max;
// In case of axis.type === 'time', Date should be converted to timestamp.
// In other cases, min/max should be a number or null/undefined.
if (max != null) {
max = +max;
}
return max;
},

/**
Expand Down

0 comments on commit 3ddf66f

Please sign in to comment.