Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sort values in actions by closest to cursor #1023

Merged
merged 3 commits into from
Feb 11, 2021

Conversation

nickofthyme
Copy link
Collaborator

Summary

closes #835

Sorts values when finding indexed geometries by closest to cursor Point. This is determined by the spatial distance between the index points and the cursor point. Will only compare across different x values in spatially indexed charts (i.e. bubble).

Example

Image 2021-02-10 at 2 09 50 PM

Clicking near the yellow arrow will now return the values in the array as 7.0 then 6.8 because the cursor is closest to 7.0

Clicking near the pink arrow will now return the values in the array as 6.8 then 7.0 because the cursor is closest to 6.8

This will also be performed on spatial maps with bubble charts and will use the closest distance, including across different x values.

Checklist

  • Any consumer-facing exports were added to src/index.ts (and stories only import from ../src except for test data & storybook)
  • Proper documentation or storybook story was added for features that require explanation or tutorials
  • Unit tests were updated or added to match the most common scenarios

@nickofthyme nickofthyme added enhancement New feature or request :interactions Interactions related issue labels Feb 10, 2021
Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and works fine when pushing out events on click/over.
Can you describe what is the current use case for that sorting?

@nickofthyme
Copy link
Collaborator Author

nickofthyme commented Feb 11, 2021

@markov00 for now, the only use case is in vislib replacement for area and line charts where points are close together and clicked to filter. This will now filter the nearest point.

@nickofthyme nickofthyme enabled auto-merge (squash) February 11, 2021 17:04
@nickofthyme nickofthyme merged commit e1da4e5 into elastic:master Feb 11, 2021
github-actions bot pushed a commit that referenced this pull request Feb 15, 2021
# [24.6.0](v24.5.1...v24.6.0) (2021-02-15)

### Bug Fixes

* **legend:** width with scroll bar ([#1019](#1019)) ([45bd0d5](45bd0d5))

### Features

* sort values in actions by closest to cursor ([#1023](#1023)) ([e1da4e5](e1da4e5))
* **axis:** small multiples axis improvements ([#1004](#1004)) ([514466f](514466f))
* **partition:** drilldown ([#995](#995)) ([20bbdae](20bbdae))
@markov00
Copy link
Member

🎉 This PR is included in version 24.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Feb 15, 2021
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
@nickofthyme nickofthyme deleted the sort-elements-in-actions branch October 16, 2023 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request :interactions Interactions related issue released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Order TooltipValues in CustomTooltip by distance to pointer
2 participants