apexcharts / apexcharts.js

📊 Interactive JavaScript Charts built on SVG
https://apexcharts.com
MIT License
14.41k stars 1.31k forks source link

Candlestick charts return incorrect datapoint on hover when sparkline is enabled (bug first appeared in v3.25 when boxplot was added) #2474

Open Elenchev opened 3 years ago

Elenchev commented 3 years ago

Bug report

image info

Hovering even a pixel to the left of the center of a candle in a candlestick chart returns an incorrect data point (previous candle). It works fine when the sparkline option is set to false. This bug appeared in build 3.25.

You can use the codesandbox link below to verify that it works fine in v3.24 (just change the apexcharts dependency version is the sidebar).

It looks like v3.25 shifted the start of the series from the candlestick midpoint to the leftmost point of the candlestick but datapoint selection on hover still uses the old logic.

Codepen

https://codesandbox.io/s/apexchart-hover-series-issue-forked-51xtq

Explanation

Both the chart crosshair & tooltip should use the datapoint closest to the cursor. This works fine for candlestick charts with sparkline:false as well as other chart types.

github-actions[bot] commented 3 years ago

Stale issue message