Bar Chart

A composable and responsive bar chart built with D3.js and Tailwind CSS.

Example

Revenue
Expenses

Installation

./components/charts/BarChart.tsx

How It Works

The Bar Chart uses d3.scaleBand for categorical X-axis and d3.scaleLinear for the Y-axis to map bar heights.

  • BarChart.Container – Chart context provider
  • BarChart.Bar – Renders each bar for a data key
  • BarChart.XAxis / YAxis – Axis rendering
  • BarChart.Legend – Displays color-to-series mapping