Visx: BarStack With Negative Values

Created on 17 May 2018  路  3Comments  路  Source: airbnb/visx

How can I use <BarStack> when one of the keys contains negative values?

I am trying to reproduce something that looks like:
screen shot 2018-05-17 at 12 19 34 am

Here's a sandbox link which demonstrates my attempt at making the demo work with negative temperatures, but it doesn't seem to work properly.

馃惎example

Most helpful comment

My fault, I don't think this is documented anywhere yet. Will add an example to gallery as well. But you need to use <Stack /> and pass in an offset prop offset={'diverging'} (d3 stack offset docs)

Here's a quick example based of your sandbox:
screen shot 2018-05-17 at 11 31 02 am

https://codesandbox.io/s/2pxzozmrlp

All 3 comments

My fault, I don't think this is documented anywhere yet. Will add an example to gallery as well. But you need to use <Stack /> and pass in an offset prop offset={'diverging'} (d3 stack offset docs)

Here's a quick example based of your sandbox:
screen shot 2018-05-17 at 11 31 02 am

https://codesandbox.io/s/2pxzozmrlp

That鈥檚 great thanks for the clarification!

It seems BarStack is still not able to handle negative values in the latest version. The example provided back in 2018 seems to be broken if using the latest version. Would you happen to have an updated example for BarStack with negative values?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hshoff picture hshoff  路  5Comments

asteroidice picture asteroidice  路  3Comments

danielprogramic picture danielprogramic  路  3Comments

BrianRosamilia picture BrianRosamilia  路  3Comments

sabarnix picture sabarnix  路  4Comments