Skip to main content
The 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

  • maxBarSize limits the maximum width of bars
  • minPointSize ensures 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 stackId prop.
  • Bar width: If bars appear too wide or narrow, use maxBarSize or 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 set XAxis type="number" and YAxis type="category".