feat(plugins): Adding colors to BigNumber with Time Comparison chart#27052
Conversation
- Add new checbox control so users can toggle colors in the chart - Make the component capable of using the right colors based on the data - Fix types in props ofthe component - Update the thumbnail of the chart
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #27052 +/- ##
==========================================
- Coverage 67.19% 67.16% -0.03%
==========================================
Files 1899 1900 +1
Lines 74369 74423 +54
Branches 8274 8293 +19
==========================================
+ Hits 49971 49988 +17
- Misses 22343 22380 +37
Partials 2055 2055
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
| comparisonColorEnabled ? backgroundColor : defaultBackgroundColor | ||
| }; | ||
| color: ${comparisonColorEnabled ? textColor : defaultTextColor}; | ||
| padding: 2px 5px; |
There was a problem hiding this comment.
could we use full grid units? Or does it look weird?
|
|
||
| const SymbolWrapper = styled.div<PopKPIComparisonSymbolStyleProps>` | ||
| ${({ theme, percentDifferenceNumber, comparisonColorEnabled }) => { | ||
| const defaultBackgroundColor = theme.colors.grayscale.light4; |
There was a problem hiding this comment.
Interesting approach with putting js inside of styled component like that! But I wonder if deducing colours from more "high-level" data belongs to a styled component. Maybe we should move that logic to PopKPI and just pass backgroundColor and textColor to SymbolWrapper?
But if you think this solution is better then I won't argue, I don't have a strong opinion here
There was a problem hiding this comment.
hehe yeah, I had it like that before and moved to this, it doesn't feel quite "well" but now that you noticed too, let's move it there instead. Thanks
|
I'm trying to upgrade Storybook, but ironing out a few last details. When that's done, we should add this plugin to Storybook and make sure it has controls for these options |
Yes! This will be included and we'll have more docs about it too. Right now it's behind Feature Flag as experimental, but an update is coming soon on that regard. Thanks |
| ? prevNumber | ||
| : index === 1 | ||
| ? valueDifference | ||
| : percentDifferenceFormattedString} |
There was a problem hiding this comment.
Hmm I'm not sure about coupling the values with indexes like this. I think it would be cleaner if we had some key-value mapping between symbols and values, or an array like [['#', prevNumber], ['△', valueDifference], ['%', percentDifferenceFormattedString]]
| prevNumber: string; | ||
| valueDifference: string; | ||
| percentDifferenceFormattedString: string; | ||
| compType: String; |
There was a problem hiding this comment.
can we also fix those capital S strings? 😛
- Move background and textcolor computation inside the main component so the Styled doesnt have to deal with logic - Stop accessing values with indexes and have a single array that collects both the symbol and the value - fix more typing
|
/testenv up FEATURE_CHART_PLUGINS_EXPERIMENTAL=true |
|
@Antonio-RiveroMartnez Ephemeral environment creation is currently limited to committers. |
|
/testenv up FEATURE_CHART_PLUGINS_EXPERIMENTAL=true |
|
/testenv up FEATURE_CHART_PLUGINS_EXPERIMENTAL=true |
|
Hey, quick note that I'm trying to fix ephemeral envs here -> #27057, hoping to merge quickly as soon as CI passes, and to confirm the fix on this PR right after... |
|
/testenv up FEATURE_CHART_PLUGINS_EXPERIMENTAL=true |
2 similar comments
|
/testenv up FEATURE_CHART_PLUGINS_EXPERIMENTAL=true |
|
/testenv up FEATURE_CHART_PLUGINS_EXPERIMENTAL=true |
|
@mistercrunch Container image not yet published for this PR. Please try again when build is complete. |
|
@mistercrunch Ephemeral environment creation failed. Please check the Actions logs for details. |
|
/testenv up FEATURE_CHART_PLUGINS_EXPERIMENTAL=true |
|
@mistercrunch Ephemeral environment spinning up at http://34.221.206.0:8080. Credentials are |
- Update Thumbnail to be square so it doest look squished
|
/testenv up FEATURE_CHART_PLUGINS_EXPERIMENTAL=true |
|
@Antonio-RiveroMartnez Ephemeral environment spinning up at http://35.87.2.140:8080. Credentials are |
|
Nit for eventual follow up PR - add advanced analytics tag? cc @yousoph
|
Yes, this PR has not been updated with latest master but a PR got merged addressing this already #27054 |
Nice! |
kgabryje
left a comment
There was a problem hiding this comment.
LGTM, the bugs I listed can be worked on in the follow up PRs
- Extract comparison period calculation to an util file and make use of it when building the query. This is to support following work that will make use of that function and to prepare us when adding proper testing.
|
Ephemeral environment shutdown and build artifacts deleted. |
…pache#27052) (cherry picked from commit e8e208d)








SUMMARY
Currently our BigNumber with Time Comparison chart has no visual indicators to help user easily tell when the differences are positive or negatives. This PR adds a customize control to enable colors in the chart.
Also this PR is updating the thumbnail to reflect an up to date version of the chart with these colors.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION