Bar chart which can display multiple data series, stacked or side by side. Also supports both vertical and horizontal layout, with negative values descending below the x axis (or y axis if using horizontal layout).
The bar item component can be customized to render any valid SVG element, it will receive current bar style, data and event handlers, the storybook offers an example.
The responsive alternative of this component is ResponsiveBar
.
This component is available in the @nivo/api
,
see sample
or try it using the API client.
See the dedicated guide on how to setup
legends for this component.
However it requires an extra property for each legend configuration you pass to
legends
property: dataFrom
, it defines how to compute
legend's data and accept indexes
or keys
.
indexes
is suitable for simple bar chart with a single data serie
while keys
may be used if you have several ones (groups).
'id'
'value'
]'stacked'
'vertical'
false
'auto'
'auto'
0.1
0
'Depends on device'
'id'
0
0
'grid'
, 'axes'
, 'bars'
, 'markers'
, 'legends'
, 'annotations'
]true
'value'
0
0
'theme'
false
true
true
true
90
15