-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Animate stacked bars in Bar Series from the 'bottom' #20862
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -783,9 +783,18 @@ const elementCreator: { | |||||
rect.name = 'item'; | ||||||
|
||||||
if (animationModel) { | ||||||
const isStacked = seriesModel.get('stack') !== undefined; | ||||||
const rectShape = rect.shape; | ||||||
const animateProperty = isHorizontal ? 'height' : 'width' as 'width' | 'height'; | ||||||
rectShape[animateProperty] = 0; | ||||||
if (isStacked) { | ||||||
// if it's stacked, the bar will be animated from the | ||||||
// 'bottom' of the value axis, irregardless of 'inverse' | ||||||
|
// 'bottom' of the value axis, irregardless of 'inverse' | |
// 'bottom' of the value axis, regardless of 'inverse' |
Copilot uses AI. Check for mistakes.
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.
fixed in 444c75d
Outdated
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.
extent[0]
is the minimum value of the axis, which may not be expected to be the starting point of bar growing in the case with negative axes. Consider using startValue instead. Make sure you test the cases in varied value ranges.
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.
yep seems like you are correct, for test/bar-stack.html
I edited the yAxis to have a startValue: -30
and min: -100
and it animates from the bottom (first 2s):
nani.mp4
The other half of the video describes a bug (not sure): the right most bar stack in that video isn't placed correctly (not respecting startValue
). And by toggling the 'bottom'-most series of the stacked bar chart, the problem fixes itself. I can raise this in a issue if this is confirmed to be a bug.
I'll fix the startValue issue in a bit;
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.
fixed in 444c75d - but will add tests in another commit
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.
!= null
should be better.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.
fixed in 444c75d