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.
|
| } | ||
|
|
||
| export interface StrokeStyle { | ||
| export interface StrokeStyle<C = Color> { |
There was a problem hiding this comment.
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.
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. |
markov00
left a comment
There was a problem hiding this comment.
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
ColorVarianttype withSeriesandNonestringToRGBmethod to use opacity andOpacityFnColorVariantColortypeColorVariantandOpacityFnThe following
Themeproperties that used to beColorare nowColor | ColorVariantPointStyle.strokePointStyle.fillLineStyle.strokeAreaStyle.fillRectStyle.fillRectBorderStyle.strokeExample Stories
Area
Line
Bar
Update tests
Checklist
src/index.ts(and stories only import from../srcexcept for test data & storybook)