Skip to content

Commit

Permalink
Enhancement of case apache#2869
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Mar 23, 2016
1 parent 3bca1c7 commit 60d341f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/data/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,14 @@ define(function (require) {
var minDist = Number.MAX_VALUE;
var nearestIdx = -1;
for (var i = 0, len = this.count(); i < len; i++) {
var dist = Math.abs(this.get(dim, i, stack) - value);
if (dist <= minDist) {
var diff = value - this.get(dim, i, stack);
var dist = Math.abs(diff);
if (dist < minDist
// For the case of two data are same on xAxis, which has sequence data.
// Show the nearest index
// https://github.com/ecomfe/echarts/issues/2869
|| (dist === minDist && diff > 0)
) {
minDist = dist;
nearestIdx = i;
}
Expand Down

0 comments on commit 60d341f

Please sign in to comment.