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(legend/click): add click interations on legend titles #51

Merged
merged 49 commits into from
Mar 6, 2019

Conversation

emmacunningham
Copy link
Contributor

@emmacunningham emmacunningham commented Feb 9, 2019

close #23
close #25
addresses #39 (not closing this as this PR doesn't introduce the props at the spec level, but does provide some underlying architecture that we can use)

Summary

This PR attaches click listeners passed in from Settings to the legend titles and also attaches some functionality for chart internal interactions. The UI is not finalized as this will require more feedback from design, but have opened up a new issue (#79) to track that feedback (and keep separate from functionality implementation).

Update series color using color picker:
legend_click_color

Toggle series visibility (currently on icon click):
legend_toggle_visibility

Toggle single series visibility (currently on icon shift-click):
legend_toggle_visibility_single

Open context menu with plus/minus buttons whose handlers will pass data to any attached listeners:
legend_interactions

Selected data series resets when specs are updated:
legend_interactions_split_fixed

[instead of this which was happening in the first pass of implementation]
legend_interactions_split_broken

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

  • This was checked for cross-browser compatibility, including a check against IE11
  • 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
  • Each commit follows the convention

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.
@markov00 markov00 mentioned this pull request Feb 18, 2019
42 tasks
@markov00 markov00 added this to the 7.1 milestone Feb 28, 2019
@markov00 markov00 added wip work in progress :interactions Interactions related issue :legend Legend related issue labels Feb 28, 2019
@markov00 markov00 changed the title [wip]feat(legend/click): add click interations on legend titles feat(legend/click): add click interations on legend titles Feb 28, 2019
@emmacunningham emmacunningham removed the wip work in progress label Mar 1, 2019
@emmacunningham emmacunningham requested a review from markov00 March 1, 2019 00:48
@markov00 markov00 force-pushed the feature/legend-click branch from f7f8d93 to 34d2a46 Compare March 1, 2019 09:56
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.

I've just done a quick manual test and I've found the following problem on the Interactions click/hovers on legend items [line chart].
If you click the eye on the last line series, everything is fine, you can turn on and off that easily.
If you click one of the others, some when hiding, some when showing, the chart will crash with the following error:

Uncaught TypeError: Cannot read property 'push' of undefined
    at konva.js:1436
    at Array.forEach (<anonymous>)
    at konva.js:1435
    at Array.forEach (<anonymous>)
    at createInterpolation (konva.js:1434)
    at Function.create (konva.js:250)
    at AnimatedInterpolation._this.updateConfig (konva.js:325)
    at konva.js:842
    at Array.reduce (<anonymous>)
    at Controller.update (konva.js:809)
The above error occurred in the <Spring> component:
    in Spring (created by LineGeometries)
    in Group (created by LineGeometries)
    in Group (created by LineGeometries)
    in LineGeometries (created by ReactiveChart)
    in Layer (created by ReactiveChart)

@emmacunningham
Copy link
Contributor Author

@markov00 Regarding the line charts, the issue was with the animation of the curved line paths, not the hide/show logic itself (this is also why the last line didn't have issues–because it wasn't a curved line path). I opened up a separate issue (#89) to look at this and for now instead of animating the line path, we use opacity, so the chart at least will render and the app doesn't crash for the visibility toggling.

line_chart_fix

@emmacunningham emmacunningham merged commit 7d6139d into elastic:master Mar 6, 2019
markov00 pushed a commit that referenced this pull request Mar 6, 2019
# [2.1.0](v2.0.0...v2.1.0) (2019-03-06)

### Features

* **legend/click:** add click interations on legend titles ([#51](#51)) ([7d6139d](7d6139d))
@markov00
Copy link
Member

markov00 commented Mar 6, 2019

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Mar 6, 2019
@markov00 markov00 removed this from the 7.1 milestone Apr 1, 2019
@markov00 markov00 mentioned this pull request Mar 27, 2020
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
# [2.1.0](elastic/elastic-charts@v2.0.0...v2.1.0) (2019-03-06)

### Features

* **legend/click:** add click interations on legend titles ([opensearch-project#51](elastic/elastic-charts#51)) ([6d756e4](elastic/elastic-charts@6d756e4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:interactions Interactions related issue :legend Legend related issue released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add click interactions on legend items Add color picker for legend item
3 participants