-
Notifications
You must be signed in to change notification settings - Fork 129
feat(listeners): add seriesIdentifiers to element listeners #525
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(listeners): add seriesIdentifiers to element listeners #525
Conversation
This commit changes the object passed to an event listener providing the value of the
clicked/hovered element together with the seriesIdentifier object
BREAKING CHANGE: the `onElementOver` and the `onElementClick` are now called with
an array of `{ value: GeometryValue; seriesId: SeriesIdentifier;}`
fix elastic#505
Codecov Report
@@ Coverage Diff @@
## master #525 +/- ##
=======================================
Coverage 75.26% 75.26%
=======================================
Files 193 193
Lines 5797 5797
Branches 1118 1118
=======================================
Hits 4363 4363
Misses 1418 1418
Partials 16 16Continue to review full report at Codecov.
|
src/specs/settings.tsx
Outdated
| value: GeometryValue; | ||
| seriesId: SeriesIdentifier; | ||
| } | ||
| export type ElementClickListener = (elements: Element[]) => void; |
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.
What do you think of...
export type ElementClickListener = (elements: Array<Array<GeometryValue, SeriesIdentifier>>) => void;Otherwise can you use seriesIdentifier rather than seriesId?
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.
fixed on f4755a9 with Array<[GeometryValue, SeriesIdentifier]>
Instead of using an Element interface, with an ambigious name, I've replaced it with a tuple of [GeometryValue, SeriesIdentifier]
# [17.0.0](v16.2.1...v17.0.0) (2020-01-30) ### Bug Fixes * **brush:** rotate brush on rotated charts ([#528](#528)) ([985ac21](985ac21)), closes [#527](#527) ### Features * text improvements ([#524](#524)) ([6e61700](6e61700)) * **listeners:** add seriesIdentifiers to element listeners ([#525](#525)) ([027d008](027d008)), closes [#419](#419) [#505](#505) ### BREAKING CHANGES * **listeners:** the `onElementOver` and the `onElementClick` are now called with `Array<[GeometryValue, SeriesIdentifier]>` instead of `Array<GeometryValue>` * renames in `Partition` charts— `Layers`: `fillLabel.formatter`->`fillLabel.valueFormatter`; type `FillLabel`-> `FillLabelConfig` Non-breaking changes: * feat: the values in linked labels are rendered, just like they have been in the sectors (formerly, the value could optionally be put in the link label accessor itself) * feat: font styling is possible separately for values: `valueFormatter` configs * test: opacity decrease example; coloring examples * feat: hierarchical data (`parent`, `sortIndex`) is made available to accessors (see stories, helpful with eg. coloring) * refactor: tighter types; other code improvements
|
🎉 This PR is included in version 17.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [17.0.0](elastic/elastic-charts@v16.2.1...v17.0.0) (2020-01-30) ### Bug Fixes * **brush:** rotate brush on rotated charts ([opensearch-project#528](elastic/elastic-charts#528)) ([b6c3302](elastic/elastic-charts@b6c3302)), closes [opensearch-project#527](elastic/elastic-charts#527) ### Features * text improvements ([opensearch-project#524](elastic/elastic-charts#524)) ([f7b53c8](elastic/elastic-charts@f7b53c8)) * **listeners:** add seriesIdentifiers to element listeners ([opensearch-project#525](elastic/elastic-charts#525)) ([643ef1b](elastic/elastic-charts@643ef1b)), closes [opensearch-project#419](elastic/elastic-charts#419) [opensearch-project#505](elastic/elastic-charts#505) ### BREAKING CHANGES * **listeners:** the `onElementOver` and the `onElementClick` are now called with `Array<[GeometryValue, SeriesIdentifier]>` instead of `Array<GeometryValue>` * renames in `Partition` charts— `Layers`: `fillLabel.formatter`->`fillLabel.valueFormatter`; type `FillLabel`-> `FillLabelConfig` Non-breaking changes: * feat: the values in linked labels are rendered, just like they have been in the sectors (formerly, the value could optionally be put in the link label accessor itself) * feat: font styling is possible separately for values: `valueFormatter` configs * test: opacity decrease example; coloring examples * feat: hierarchical data (`parent`, `sortIndex`) is made available to accessors (see stories, helpful with eg. coloring) * refactor: tighter types; other code improvements
Summary
This PR changes the object passed to the event listeners providing either the value of the
clicked/hovered element and with the
SeriesIdentifierobject that can uniquely identify a series in elastic-charts. (see #419 for a description on SeriesIdentifiers)BREAKING CHANGE: the
onElementOverand theonElementClickare now called withArray<[GeometryValue, SeriesIdentifier]>instead ofArray<GeometryValue>fix #505
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.src/index.ts(and stories only import from../srcexcept for test data & storybook)