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(bar_chart): color overrides #271

Merged
merged 6 commits into from
Aug 5, 2019

Conversation

nickofthyme
Copy link
Collaborator

@nickofthyme nickofthyme commented Jul 24, 2019

Summary

Allow user to override colors of given datum based on accessor function.

interface RawDataSeriesDatum {
  x: number | string;
  y1: number | null;
  y0?: number | null;
  datum?: any;
}
interface GeometryId {
  specId: SpecId;
  seriesKey: any[];
}
type Color = string;
type StyleOverride = RecursivePartial<BarSeriesStyle> | Color | null;
type StyleAccessor = (datum: RawDataSeriesDatum, geometryId: GeometryId) => StyleOverride;

BREAKING CHANGE: Replace ColorAccessor prop and functionality with StyleAccessor

Screen Recording 2019-07-24 at 02 02 PM

#216

Checklist

  • 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

Allow user to override colors of given datum based on accessor function

elastic#216
@nickofthyme nickofthyme added :styling Styling related issue enhancement New feature or request labels Jul 24, 2019
@nickofthyme
Copy link
Collaborator Author

nickofthyme commented Jul 24, 2019

I didn't label these changes as breaking because I don't think anyone is using the colorAccessors attribute of the SeriesSpec. But technically, I am removing colorAccessors in place of colorAccessor.

@codecov-io
Copy link

codecov-io commented Jul 24, 2019

Codecov Report

Merging #271 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #271      +/-   ##
==========================================
+ Coverage   98.05%   98.05%   +<.01%     
==========================================
  Files          37       37              
  Lines        2671     2680       +9     
  Branches      613      615       +2     
==========================================
+ Hits         2619     2628       +9     
  Misses         47       47              
  Partials        5        5
Impacted Files Coverage Δ
src/chart_types/xy_chart/utils/specs.ts 100% <ø> (ø) ⬆️
src/chart_types/xy_chart/store/utils.ts 96.68% <ø> (ø) ⬆️
src/chart_types/xy_chart/domains/y_domain.ts 100% <ø> (ø) ⬆️
src/chart_types/xy_chart/rendering/rendering.ts 99.32% <100%> (+0.04%) ⬆️
src/chart_types/xy_chart/utils/series.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8b206c...c87a7bb. Read the comment docs.

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.

Not already tested locally, but I've left few comments.
I think it's better to specify that as a breaking change to correctly align the semver with the code changes also if no one is using the colorAccessor

src/chart_types/xy_chart/rendering/rendering.ts Outdated Show resolved Hide resolved
src/chart_types/xy_chart/rendering/rendering.ts Outdated Show resolved Hide resolved
src/chart_types/xy_chart/utils/specs.ts Outdated Show resolved Hide resolved
@nickofthyme
Copy link
Collaborator Author

@markov00 Could you review this again when you have time?

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.

Code LGTM!
Remember to add the BREAKING CHANGE footer on the merge commit with the description of the changes.
Thanks!

@nickofthyme nickofthyme merged commit 7634f5c into elastic:master Aug 5, 2019
@nickofthyme nickofthyme deleted the feat/bar-color-overrides branch August 5, 2019 19:46
markov00 pushed a commit that referenced this pull request Aug 5, 2019
# [9.0.0](v8.1.8...v9.0.0) (2019-08-05)

### Features

* **bar_chart:** color/style override accessor ([#271](#271)) ([7634f5c](7634f5c)), closes [#216](#216)

### BREAKING CHANGES

* **bar_chart:** colorAccessors removed from YBasicSeriesSpec (aka for all series) which had acted similarly to a split accessor.
@markov00
Copy link
Member

markov00 commented Aug 5, 2019

🎉 This PR is included in version 9.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Aug 5, 2019
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
# [9.0.0](elastic/elastic-charts@v8.1.8...v9.0.0) (2019-08-05)

### Features

* **bar_chart:** color/style override accessor ([opensearch-project#271](elastic/elastic-charts#271)) ([764f127](elastic/elastic-charts@764f127)), closes [opensearch-project#216](elastic/elastic-charts#216)

### BREAKING CHANGES

* **bar_chart:** colorAccessors removed from YBasicSeriesSpec (aka for all series) which had acted similarly to a split accessor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released Issue released publicly :styling Styling related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants