BarChart component displays data as rectangular bars with lengths proportional to the values they represent. Use it to compare values across categories.
Basic bar chart
Stacked bars
Bars with the same
stackId will be stacked on top of each other.Horizontal bar chart
Customized bar shape
Bar with labels
Custom bar size
maxBarSizelimits the maximum width of barsminPointSizeensures small values remain visible
Mixed bar chart
Combine regular and stacked bars in the same chart.Negative values
Common pitfalls
- Stacking confusion: Bars will only stack if they have the same
stackIdprop. - Bar width: If bars appear too wide or narrow, use
maxBarSizeor adjust chart margins. - Tooltip event type: BarChart supports both
'axis'and'item'tooltip event types. The default is'axis'. - Layout mismatch: When using
layout="horizontal", remember to setXAxis type="number"andYAxis type="category".