Skip to content

BarStack ability to add radius to only top of bars #1446

Answered by williaster
THAgility asked this question in Q&A
Discussion options

You must be logged in to vote

hey @THAgility ! thanks for checking out visx 🙏

can you elaborate on which package(s) you're using? in particular @visx/xychart or the lower-level @visx/shape which also has a stack? if you're using @visx/xychart, this discussion might give you what you need.

if you're using @visx/shape, you'll need to use its custom children render function as a way to customize what it's rendering. It's default implementation uses Bars which are svg rects, and although those have rx/ry props, you can't set them on just the top or bottom. Because of this we have a custom shape BarRounded implemented as a path, which adds curves as needed. You'd then do something like

<BarStack {...}>
  {(bars) => (
    <G…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@THAgility
Comment options

Answer selected by THAgility
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants