-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Update BigNumber #5469
Update BigNumber #5469
Conversation
Welcome on board @kristw! Please paste a screenshot. [optional] you may want to preserve the original commit to keep the attribution in place and make it possible to see the changes on top of the original PR. We'd have to be careful to |
no worries about the history preservation, I closed #4313. I think we'll still iterate on the styling of this to make sure there's an option to set color based on the compare ratio delta. |
96982c0
to
b73f33e
Compare
Codecov Report
@@ Coverage Diff @@
## master #5469 +/- ##
==========================================
+ Coverage 63.29% 63.31% +0.02%
==========================================
Files 349 349
Lines 22194 22212 +18
Branches 2467 2473 +6
==========================================
+ Hits 14047 14064 +17
- Misses 8133 8134 +1
Partials 14 14
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.
This looks great to me overall, nice improvements! This will look so much better 😍
One question: it looks like BigNumber
supports a className
, what are your thoughts on varying the className
based on the trend (+/-, or 0)? That way you could have custom css hooks to change color based on this.
Will get the react-15-compatible @data-ui/xy-chart
version out ASAP.
}; | ||
} | ||
|
||
const propTypes = { |
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.
future lint rules will require all PropTypes
that aren't required to have defaults, could add those now.
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.
sure. will take care of that.
BigNumberVis.propTypes = propTypes; | ||
BigNumberVis.defaultProps = defaultProps; | ||
|
||
function adaptor(slice, payload) { |
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.
❤️ the term adaptor
for this + code style here
stroke-width: 1; | ||
.big_number_header_line { | ||
position: relative; | ||
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif; |
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.
do you need to define font-family
more than once or can you inherit from the container? or is this necessary for proper size-detection?
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.
Necessary for proper size detection. The getTextDimension function accept className and create svg text with that class.
const fontSize = computeMaxFontSize({
text,
maxWidth: width,
maxHeight,
className: 'big_number_header_line',
});
Otherwise the util function will have to create same nesting structure (with outer container have .big_number
) or be able to accept parent DOM node (which does not exist yet).
I understand this looks annoyingly redundant, but don't have a good work around yet. Unless all body use same font family.
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.
makes sense 👍and I agree no obvious work around. We could possibly add a comment in the css that removing it would potentially break proper sizing.
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.
I thought about this again and made the util function accept container DOM element, therefore got rid of the font family.
@williaster For clarification, will the positive/negative cssClass be for subheader? I think that should be doable. Will find a clean way to do it. |
yeah I think that'd make the most sense. could possibly add it for the trend line, but actually they could probably change that if they really wanted if the header had the class. |
superset/assets/package.json
Outdated
@@ -45,6 +45,7 @@ | |||
"dependencies": { | |||
"@data-ui/event-flow": "^0.0.54", | |||
"@data-ui/sparkline": "^0.0.54", | |||
"@data-ui/xy-chart": "^0.0.60-alpha.1.0", |
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.
0.0.60
is out now FYI
5c8bd19
to
98ab56a
Compare
support toggling trend line experiment using svg to measure size instead of canvas refactor BigNumber with chart sticked to the bottom made header line stick to bottom and css adjustment remove commented code fix svg text size estimation remove unused code and round dimensions handle missing getbbox remove vx/text from dependency ensure svg deletion after measurement add comment to css file. Add `positive` and `negative` class based on diff. Add default props. rename variable accept container as argument and remove redundant font family refactor visutils for consistent api update xy-chart update xy-chart to alpha1.0 fix pointseries remove points update yarn.lock [4c9c01d7] update xy-chart version remove unused import
98ab56a
to
c935050
Compare
@williaster ready to merge |
solid 🙌 🚢 |
support toggling trend line experiment using svg to measure size instead of canvas refactor BigNumber with chart sticked to the bottom made header line stick to bottom and css adjustment remove commented code fix svg text size estimation remove unused code and round dimensions handle missing getbbox remove vx/text from dependency ensure svg deletion after measurement add comment to css file. Add `positive` and `negative` class based on diff. Add default props. rename variable accept container as argument and remove redundant font family refactor visutils for consistent api update xy-chart update xy-chart to alpha1.0 fix pointseries remove points update yarn.lock [4c9c01d7] update xy-chart version remove unused import
Revise the big number design.
BigNumberVis
as react component, with simple adaptor for transforming superset data into it. The trendline is adata-ui
component.visutils
to use svg for text size estimation because svg can support css class and also returns height whilecontext.measureText()
only returns width and does not support css class.Reference: Refactored from PR 4313 by @williaster
cf2c0ff