-
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: add color option to use series color #630
Conversation
- Add ColorVariant type with Series and None - Series option can be used for any series-related color in the theme object - None option can be used to set a default color value to transparent - Refactor stringToRGB method to use opacity and opacityFn - Add helper method to process ColorVariant - Update theme color string with Color type - Refactor renderer styles to allow for new ColorVariant and OpacityFn
Codecov Report
@@ Coverage Diff @@
## master #630 +/- ##
==========================================
+ Coverage 66.44% 74.84% +8.39%
==========================================
Files 240 253 +13
Lines 7012 7242 +230
Branches 1340 1371 +31
==========================================
+ Hits 4659 5420 +761
+ Misses 2337 1798 -539
- Partials 16 24 +8
Continue to review full report at Codecov.
|
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.
@@ -58,9 +58,9 @@ export interface SharedGeometryStateStyle { | |||
unhighlighted: GeometryStateStyle; | |||
} | |||
|
|||
export interface StrokeStyle { | |||
export interface StrokeStyle<C = Color> { |
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 is the benefit of having a generic type here? I think we don't want that to have someone using a different generic value other than Color here like StrokeStyle<number>
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.
Yeah I didn't need this but I thought this was shared between more interfaces on the theme.
The intent was to be able to add the ColorVariant
as an option for color. But in some places in the theme that doesn't apply.
Thanks for pointing out the linecap issue. I saw that in safari and firefox. Looks to be fixed with this 80da4fc. |
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.
Changes LGTM.
Ok to merge after fixing the rendering error on the debug react (caused by the linecap)
# [18.4.0](v18.3.0...v18.4.0) (2020-04-22) ### Bug Fixes * **partition:** single slice wrong text positioning ([#643](#643)) ([6298d36](6298d36)), closes [#637](#637) * **treemap:** align onElementClick parameters to sunburst ([#636](#636)) ([2c1d224](2c1d224)), closes [#624](#624) ### Features * allow colorVariant option for series specific color styles ([#630](#630)) ([e5a206d](e5a206d)) * **series:** BubbleSeries (alpha) and markSizeAccessor ([#559](#559)) ([3aa235e](3aa235e))
# [18.4.0](elastic/elastic-charts@v18.3.0...v18.4.0) (2020-04-22) ### Bug Fixes * **partition:** single slice wrong text positioning ([opensearch-project#643](elastic/elastic-charts#643)) ([f8b5b8a](elastic/elastic-charts@f8b5b8a)), closes [opensearch-project#637](elastic/elastic-charts#637) * **treemap:** align onElementClick parameters to sunburst ([opensearch-project#636](elastic/elastic-charts#636)) ([8dd87bf](elastic/elastic-charts@8dd87bf)), closes [opensearch-project#624](elastic/elastic-charts#624) ### Features * allow colorVariant option for series specific color styles ([opensearch-project#630](elastic/elastic-charts#630)) ([e2444ef](elastic/elastic-charts@e2444ef)) * **series:** BubbleSeries (alpha) and markSizeAccessor ([opensearch-project#559](elastic/elastic-charts#559)) ([85d9bda](elastic/elastic-charts@85d9bda))
Summary
Add
ColorVariant
type withSeries
andNone
stringToRGB
method to use opacity andOpacityFn
ColorVariant
Color
typeColorVariant
andOpacityFn
The following
Theme
properties that used to beColor
are nowColor | ColorVariant
PointStyle.stroke
PointStyle.fill
LineStyle.stroke
AreaStyle.fill
RectStyle.fill
RectBorderStyle.stroke
Example Stories
Area
Line
Bar
Update tests
Checklist
src/index.ts
(and stories only import from../src
except for test data & storybook)