Animation on VictoryBar with y0 values
Bugs and Questions
Checklist
-
[x] This is not a
victory-nativespecific issue. (Issues that only appear invictory-nativeshould be opened here) -
[x] I have read through the FAQ and Guides before asking a question
-
[x] I am using the latest version of Victory
-
[x] I've searched open issues to make sure I'm not opening a duplicate issue
The Problem
I'd like to animate my VictoryBar. My data has y0 values (as explained in the docs here https://formidable.com/open-source/victory/docs/victory-bar/#data). When setting animate={true}, the bars animate from below the y0 value.
I'd like to have the data animate from the y0 value. Is this possible?
Reproduction
https://codesandbox.io/s/jz7p49v12y?fontsize=14
VictoryBar uses some default entrance / exit / load transitions that look like this:
onLoad: {
duration: 2000,
before: () => ({ _y: 0, _y1: 0, _y0: 0 }),
after: (datum) => ({ _y: datum._y, _y1: datum._y1, _y0: datum._y0 })
},
onExit: {
duration: 500,
before: () => ({ _y: 0, yOffset: 0 })
},
onEnter: {
duration: 500,
before: () => ({ _y: 0, _y1: 0, _y0: 0 }),
after: (datum) => ({ _y: datum._y, _y1: datum._y1, _y0: datum._y0 })
}
Since you have a non-zero y0 value, you will want to alter these to your new baseline. I've forked your sandbox and changed the values: https://codesandbox.io/s/ov9mrlyolz
Since you don't have any exit or entrance transitions, only the onLoad change is necessary, but I've included the others just in case.