Skip to content

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

Merged
nickofthyme merged 3 commits intoelastic:masterfrom
nickofthyme:sort-elements-in-actions
Feb 11, 2021
Merged

feat: sort values in actions by closest to cursor#1023
nickofthyme merged 3 commits intoelastic:masterfrom
nickofthyme:sort-elements-in-actions

Conversation

@nickofthyme
Copy link
Copy Markdown
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
@nickofthyme nickofthyme requested a review from markov00 February 10, 2021 20:17
Copy link
Copy Markdown
Collaborator

@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
Copy Markdown
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
Copy Markdown
Collaborator

🎉 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