Skip to content

Area Chart

DataMIT
View in Storybook

Smooth gradient area chart with series, tooltip, and legend.

bun add @otfdashkit/ui

Preview

Area Chart
Loading Storybook preview…

Code

import { AreaChart } from '@otfdashkit/ui'

const MONTHLY_DATA = [
  { month: 'Jan', revenue: 4200, users: 240, churn: 12 },
  { month: 'Feb', revenue: 5800, users: 310, churn: 18 },
  { month: 'Mar', revenue: 5200, users: 290, churn: 9 },
  { month: 'Apr', revenue: 7100, users: 420, churn: 15 },
  { month: 'May', revenue: 8400, users: 510, churn: 22 },
  { month: 'Jun', revenue: 7600, users: 480, churn: 19 },
  { month: 'Jul', revenue: 9200, users: 580, churn: 28 },
  { month: 'Aug', revenue: 10400, users: 640, churn: 24 },
]

export function Example() {
  return <AreaChart data={MONTHLY_DATA} dataKey={['revenue', 'users']} xAxisKey="month" height={280} showLegend />
}

Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.

Props

Props declared in the AreaChart source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
datarequiredRecord<string, unknown>[]
dataKeyrequiredstring | string[]
classNamestring
colorsstring[]
curvedbooleantrue
heightnumber300
showGridbooleantrue
showLegendbooleanfalse
showTooltipbooleantrue
xAxisKeystring'name'