/

Horizontal Bar Chart

Horizontal bars for long category labels and ranking comparisons. Data flows left to right.

Usage

example.tsx
import { HorizontalBarChart } from "@chartts/react"

<HorizontalBarChart
  data={teamData}
  x="department"
  y="headcount"
  sorted
/>

Props

PropTypeDescription
dataT[]Array of data objects
xkeyof TKey for category labels
ykeyof TKey for bar values
sortedbooleanSort bars by value. Default: false
radiusnumberBorder radius. Default: 4

Features

  • Automatic label alignment
  • Sort by value ascending/descending
  • Value labels at bar end
  • Grouped variant
  • Animated entry
  • Responsive label truncation

Other Charts