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

fix: interaction in linear/log x scales #1258

Merged

Conversation

markov00
Copy link
Member

Summary

The interaction with a log scale across the X axis is now fixed and works correctly. A bug that wrongly computes the inverse value from a projected mouse coordinate is fixed.

Before:

Jul-19-2021.16-42-33.mp4

After:

Jul-19-2021.16-42-50.mp4

Details

The inverseWithStep function takes care of inverting a set of screen coordinates to data coordinates.
We have two main scales: a continuous and a band/categorical one. There is a third scale type: a continuous scale that is actually formed by consecutive bands (used with time bar charts for example). This third scale type works like a continuous scale but the internal logic make use of bandwidth and minInterval to correctly compute the bar width.
This is true only for bar charts, for line/area charts there is no bandwidth. The code was checking for the wrong parameter, instead of bandwidth it was checking for the minInterval that is always present and > 0.

Issues

Checklist

  • The proper chart type label was added (e.g. :xy, :partition) if the PR involves a specific chart type
  • The proper feature label was added (e.g. :interactions, :axis) if the PR involves a specific chart feature
  • Whenever possible, please check if the closing issue is connected to a running GH project
  • Any consumer-facing exports were added to packages/charts/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

@markov00 markov00 added bug Something isn't working :interactions Interactions related issue :xy Bar/Line/Area chart related labels Jul 19, 2021
Copy link
Contributor

@rshen91 rshen91 left a comment

Choose a reason for hiding this comment

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

Nice! LGTM - tested locally, thanks for the story addition 👍🏻

Copy link
Collaborator

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

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

Nice!! One liner magic! 🎱

@markov00 markov00 enabled auto-merge (squash) July 20, 2021 07:48
@markov00 markov00 merged commit db94db2 into elastic:master Jul 20, 2021
markov00 added a commit to markov00/elastic-charts that referenced this pull request Jul 20, 2021
nickofthyme pushed a commit that referenced this pull request Jul 20, 2021
## [32.0.1](v32.0.0...v32.0.1) (2021-07-20)

### Bug Fixes

* **xy:** interaction in linear/log x scales ([#1258](#1258)) ([#1259](#1259)) ([ca8fd30](ca8fd30))
nickofthyme pushed a commit that referenced this pull request Jul 20, 2021
## [33.0.2](v33.0.1...v33.0.2) (2021-07-20)

### Bug Fixes

* **xy:** interaction in linear/log x scales ([#1258](#1258)) ([db94db2](db94db2))
@nickofthyme
Copy link
Collaborator

🎉 This PR is included in version 33.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nickofthyme nickofthyme added the released Issue released publicly label Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport bug Something isn't working :interactions Interactions related issue released Issue released publicly :xy Bar/Line/Area chart related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants