You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/09/23 10:56:08 UTC

[incubator-echarts] branch pr/13317 updated: fix(List): fix wrong indicesOfNearest when data is sampled

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch pr/13317
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git


The following commit(s) were added to refs/heads/pr/13317 by this push:
     new ec736db  fix(List): fix wrong indicesOfNearest when data is sampled
ec736db is described below

commit ec736db98a6832a8c6e0e7c1f9aa6a5f1b4eaf83
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Sep 23 18:55:41 2020 +0800

    fix(List): fix wrong indicesOfNearest when data is sampled
---
 src/data/List.ts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/data/List.ts b/src/data/List.ts
index 46aa5e8..84a50bc 100644
--- a/src/data/List.ts
+++ b/src/data/List.ts
@@ -1138,7 +1138,8 @@ class List<
         // Check the test case of `test/ut/spec/data/List.js`.
         for (let i = 0, len = this.count(); i < len; i++) {
             const chunkIndex = mathFloor(i / chunkSize);
-            const chunkOffset = i % chunkSize;
+            const dataIndex = this.getRawIndex(i);
+            const chunkOffset = dataIndex % chunkSize;
             const diff = value - (dimData[chunkIndex][chunkOffset] as number);
             const dist = Math.abs(diff);
             if (dist <= maxDistance) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org