-
Notifications
You must be signed in to change notification settings - Fork 727
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
test(xychart): add AreaStack tests #1036
test(xychart): add AreaStack tests #1036
Conversation
@@ -66,7 +66,11 @@ export default function BaseAxis<Scale extends AxisScale>({ | |||
? (width ?? 0) - (margin?.right ?? 0) | |||
: 0; | |||
|
|||
return ( | |||
const scale = (orientation === 'left' || orientation === 'right' ? yScale : xScale) as |
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.
Would this look cleaner?
const scale: Scale | undefined = ...
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.
Definitely ideal, but the type won't work without a coercion either here, or when I get the scales from DataContext
(I haven't successfully figured out how to use generics with Context
types; most Series coerce the Context
values right now)
* fix(xychart/BaseAxis): handle undefined scale * fix(xychart/useDimensions): fix partial initialDimensions * new(xychart/useScales): avoid NaN domain when no values are present * fix(xychart/DataProvider): no negative ranges or dimensions * fix(xychart/getScaleBandwidth): handle undefined scale case * test(xychart): add AreaStack, useStackedData tests
* new(xychart): mid AreaStack addition * new(xychart/useStackedData): improve logic for all stack offsets * new(xychart): add working polished AreaStack, AnimatedAreaStack * lint(xychart/private/BaseAreaStack) * fix(demo/xychart): fix BaseAreaStack import * fix(xychart/stack): fix component names + comment copy * test(xychart): add AreaStack tests (#1036) * fix(xychart/BaseAxis): handle undefined scale * fix(xychart/useDimensions): fix partial initialDimensions * new(xychart/useScales): avoid NaN domain when no values are present * fix(xychart/DataProvider): no negative ranges or dimensions * fix(xychart/getScaleBandwidth): handle undefined scale case * test(xychart): add AreaStack, useStackedData tests * test(xychart): fix tests to handle undefined scales
🏠 Internal
This adds tests for
useStackedData
andAreaStack
added in #1019🐛 Bug Fix
In the process of adding tests I fixed two
DataProvider
issues which can result in invalid scales on initial render:useDimensions
could result inwidth
,height
, ormargin
beingundefined
upon initialization, resulting in invalidscale.range
d3
scales initialized withdomain: []
result indomain = [NaN, NaN]
, which previously could happen when no data was present in the data registry (now we deferscale
initialization until data is present)@kristw @hshoff