Victory Charts background grid
Asked Answered
C

2

9

Is it possible to display a grid like this using Victory charts?

enter image description here

So far I can only get a grid with both vertical and horizontal lines on top of my bars likes this:

enter image description here

Costanzo answered 23/10, 2018 at 18:34 Comment(0)
C
10

The horizontal bars can be removed by removing stroke style. The vertical bars which I wanted to keep can be 'moved' behind by changing the order of the elements as noted here: https://formidable.com/open-source/victory/guides/layout/#svg-render-order

Costanzo answered 24/10, 2018 at 13:38 Comment(0)
B
5

By providing

style={{
      grid: { stroke: '#ddd444', strokeWidth: 1.5 },
    }}

to your dependant axis like

<VictoryAxis
        dependentAxis
        tickFormat={(tick) => `${tick}`}
        style={{
          grid: { stroke: '#F4F5F7', strokeWidth: 0.5 },
        }}
      />

you will achieve desired result.

Brevet answered 12/10, 2021 at 11:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.