-
Notifications
You must be signed in to change notification settings - Fork 121
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(legend/series): add hover interaction on legend items #31
feat(legend/series): add hover interaction on legend items #31
Conversation
I think it's fine for now adding the opacity. We can add a border later, but I will let the design team decide
yes you are right.
Yes please, add a GeometryValue also on AreaGeometry and LineGeometry. it can be a
Or another possibility is to add on the datum an array of GeometryValues? I will reduce that to the minimum required for the highlight for the moment and than we can add more data if we need it |
@markov00 Thank you for the input! See efd482d for how the necessary And to address the shared styles (as well as the likelihood that design team will offer more feedback on ways to distinguish the highlighted series), see these commits: ae908ae and 647edd6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added few comments. Can you also add 4 stories to simulate that hover effects?
- one only bars
- one only lines
- one only areas
- one with areas, bars and lines
Previously, LineGeometry and AreaGeometry did not have specId and seriesKey but rather had those properties within each of their points. This meant that there wasn't a way to use specId and seriesKey on the whole geometry, but required accessing a point within the geometry.
647edd6
to
409097e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested the interaction and I see two last main (one minor) issues:
- minor: do we always want to have the highlight on legend enabled? we can maybe add a general strategy to deal with defaults interactions like these ones (on a different PR)
- major: I've see that the over, out listeners fires few times hovering the same element (see gif) seems that between the two elements, on the padding, the pointer pass through and a mouseout is fired between the dot and the text. I think we should check this and have a consistent mouseover-mouseout event.
-nit: do you mind adding a hover style on the legend item? an underline for the moment is fine, just to have a feedback on the hovered element.
👍 Opened a separate issue to track this for a new PR. (#56)
Using mouseenter/leave fixes this. See 3fe141a
Yes, I had ended up handling this in the PR for the legend click feature, which you can see here: https://github.com/elastic/elastic-charts/pull/51/files#diff-f6c762a3a7e1c32b9339b3e7cdc3fff1R101. I cherry-picked the hover style (669da2a). |
@markov00 One more thing: I think there will be some big conflicts with the new Theme structure from #44, so it is probably best first to merge that one and then I can resolve those conflicts here (and in the other legend item PR that is open, which is marked WIP until this one is merged in because that was branched off of this one). |
🎉 This PR is included in version 1.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [1.1.0](elastic/elastic-charts@v1.0.2...v1.1.0) (2019-02-14) ### Features * **legend/series:** add hover interaction on legend items ([opensearch-project#31](elastic/elastic-charts#31)) ([5af28cd](elastic/elastic-charts@5af28cd)), closes [opensearch-project#24](elastic/elastic-charts#24)
This PR implements the feature (see #24) to add a hover interaction with legend items that highlights the corresponding series in the chart. Currently, this is implemented to set the opacity of the non-highlighted series to 0.25 and the highlighted series to 1. This renders like below:
bar series:
line series:
area series:
mixed series:
Per the discussion below, there is also a refactoring of how
specId
andseriesKey
are associated with a Geometry. All Geometries now have will have these properties as they are required to be able to identify a specific geometry belonging to a spec within a series.Also, per the discussion below, as we will likely want to share some common styles across all the different geometries, while this PR only introduces the stylistic feature of changing the opacity based on a highlighted legend item, there is the ability to update these shared styles in a way that allows for re-use across geometries.