Victory: Single `VictoryBar` Components Won't Change Width

Created on 1 Aug 2018  Â·  5Comments  Â·  Source: FormidableLabs/victory

The Problem

When you have a graph that has VictoryBar components all on the same axis using VictoryStack, you cannot adjust the width/size of the bars.

Once you add other bars on a different axis, then you can change the widths and everything, so this problem only occurs when there's a _single_ stack of bars.

screen shot 2018-08-01 at 12 23 07 pm

Reproduction

https://codesandbox.io/embed/rm62zk4lzm

bug

All 5 comments

@nickzuber thank you for this issue. I will get this fixed for the next release

@boygirl Thanks! 😄

Actually, after taking a closer look at your sandbox, this is not an issue with the library.

The width prop on VictoryBar refers to the overall svg width, not the bar width. To define the bar width, you should add a width attribute to your data styles like

style={{ data: { width: 20 } }}

You can add that prop on either VictoryStack or VictoryBar, or both, but conflicting styles defined on VictoryBar will take precedence.

@boygirl Ah I see, that definitely does the trick — thank you! I wish that could somehow be more clear in the docs

@nickzuber Definitely. I'm thinking of adding a barWidth prop so that styles are restricted to valid svg styles

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iffy picture iffy  Â·  5Comments

nicmesan picture nicmesan  Â·  6Comments

tylermassey picture tylermassey  Â·  5Comments

timhwang21 picture timhwang21  Â·  4Comments

theinterned picture theinterned  Â·  3Comments