Search code examples
javascriptreactjsvictory-charts

How to wrap VictoryBar with the container?


Is it possible to wrap each VictoryBar with the container?

Code: https://codesandbox.io/s/funny-cloud-gyt8i

enter image description here

I want to see something like this: enter image description here

And also be able to add some elements inside this container.

P.S. I also opened the same issue on GitHub: https://github.com/FormidableLabs/victory/issues/1904


Solution

  • Yes. It is possible.

    We can create an additional VictoryBar with dataComponent prop and pass a custom component. This custom component can use victory primitives such as Box.

    An example is here: https://codesandbox.io/s/nostalgic-pasteur-uj1m3