c3js / c3

:bar_chart: A D3-based reusable chart library
http://c3js.org
MIT License
9.33k stars 1.39k forks source link

correct handling of grouped tooltip for multiple xs charts #2701

Closed panthony closed 4 years ago

panthony commented 4 years ago

My first attempt at reintroducing back the grouped tooltip feature was wrong as it make the assumption that data were evenly distributed (because this is my main use case).

This PRs try a different approach, it never relies on values index (filterByIndex) but always on their X value (filterByX).

If we did not find a closest value satisfying the "click" conditions (directly hovering a bar or under point_sensitivity distance) then we find the closest value alongs the X axis from the mouse as starting point.

Closes #2700

codecov-io commented 4 years ago

Codecov Report

Merging #2701 into master will increase coverage by 0.1%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #2701     +/-   ##
=========================================
+ Coverage   82.68%   82.78%   +0.1%     
=========================================
  Files          59       59             
  Lines        4718     4729     +11     
=========================================
+ Hits         3901     3915     +14     
+ Misses        817      814      -3
Impacted Files Coverage Δ
src/data.js 90% <100%> (+0.86%) :arrow_up:
src/interaction.js 81.44% <100%> (+0.59%) :arrow_up:
src/tooltip.js 82.11% <0%> (+0.81%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 93dcd65...9fb271e. Read the comment docs.