apache / apache/echarts

[Bug] series `sampling` breaks `updateAxisPointer` action

Open
#19,814 3 comments 0 reactions 0 assignees View on GitHub
bug en pending
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.5.0

### Link to Minimal Reproduction

https://jsfiddle.net/86yt7Lr1/

### Steps to Reproduce

1. Create chart with `line` type series and use `sampling: 'lttb'`.
2. Have data size large enougth to trigger downsampling. i.e. ~ 2x pixel width
3. Call `chart.dispatchAction({type:'updateAxisPointer', dataIndex: })`
4. Fails when dataIndex is "downsampled"

### Current Behavior

The axispointer is not triggered some % of the time (depending on level of downsampling).

### Expected Behavior

Work regardless of the use of `sampling` in the series options.

### Environment

```markdown
- OS: any
- Browser: any
- Framework: none
```

### Any additional comments?

I think the issue might be in https://github.com/apache/echarts/blob/c576f0c395ef9af87461fe93bcaa4490d89a331a/src/data/DataStore.ts#L550-L565

There is an effort to binary search for the correct index but it only works if it finds an exact match. Otherwise it falls through and returns -1 to indicate the value was not found and nothing works. If this function returned the closest index instead, then it would work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.