Charts

Copy-paste chart examples for every Bklit UI component.

Composed Chart

One time axis, one Y scale: combine SeriesBar, Line, and Area. Use the curve menu to swap the shared Line and Area interpolation.

import { curveCatmullRom } from "@visx/curve";<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} xDataKey="date" aspectRatio="2 / 1" barGap={0} maxBarSize={32}>  <Grid horizontal />  <Area dataKey="runRate" curve={curveCatmullRom.alpha(0.42)} fill="var(--chart-4)" fillOpacity={0.32} />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={4} />  <Line dataKey="revenue" curve={curveCatmullRom.alpha(0.42)} stroke="var(--chart-1)" strokeWidth={2.5} />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Hero uses a Radix Select for the Line and Area `curve` prop (SeriesBar shape is unchanged). See https://visx.airbnb.tech/docs/curve.

Composed Chart — Bar + line

30 daily points with rounded SeriesBar tops (`radius`) and a smoothed revenue line

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} xDataKey="date" aspectRatio="3 / 2" barGap={0} maxBarSize={32}>  <Grid horizontal />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={5} />  <Line dataKey="revenue" stroke="var(--chart-1)" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Dense time series: use numTicks on XAxis so labels stay readable. Ticks snap to data rows by default so crosshair and tooltip align.

Composed Chart — Lime / amber / red

Fixed hex accents (tailwind lime-300, amber-300, red-500) with rounded bars

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} aspectRatio="3 / 2" barGap={0} maxBarSize={30} xDataKey="date">  <Grid horizontal />  <Area dataKey="runRate" fill="#ef4444" fillOpacity={0.22} stroke="#ef4444" strokeWidth={1.5} />  <SeriesBar dataKey="units" fill="#bef264" radius={6} stroke="#bef264" />  <Line dataKey="revenue" stroke="#fcd34d" strokeWidth={2.5} />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Trending up by 5.2% this month

Composed Chart — Stacked SeriesBar + line

Two stack segments per day with the same 30-day timeline; stackGap={0} for flush stacks

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} aspectRatio="3 / 2" stacked stackGap={0} barGap={0} maxBarSize={28}>  <Grid horizontal />  <SeriesBar dataKey="direct" fill="var(--chart-3)" />  <SeriesBar dataKey="partner" fill="var(--chart-5)" />  <Line dataKey="revenue" stroke="var(--chart-1)" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Trending up by 5.2% this month

Composed Chart — Grouped bars, no gap

Two SeriesBar series per day with barGap={0}; rounded tops on both bar series

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} aspectRatio="3 / 2" barGap={0} maxBarSize={26}>  <Grid horizontal />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={4} />  <SeriesBar dataKey="runRate" fill="var(--chart-5)" radius={4} />  <Line dataKey="revenue" stroke="var(--chart-1)" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Trending up by 5.2% this month

Composed Chart — Pattern fills

One SeriesBar with a fuchsia-400 diagonal pattern, one solid bar on theme colors; revenue line unchanged

import { PatternLines } from "@bklitui/ui/charts";<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} aspectRatio="3 / 2" barGap={0} maxBarSize={22}>  <PatternLines id="composed-pat-fuchsia" height={6} width={6} orientation={["diagonal"]} stroke="#e879f9" strokeWidth={1} />  <Grid horizontal />  <SeriesBar dataKey="units" fill="url(#composed-pat-fuchsia)" stroke="#e879f9" />  <SeriesBar dataKey="runRate" fill="var(--chart-5)" />  <Line dataKey="revenue" stroke="var(--chart-1)" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Trending up by 5.2% this month

Composed Chart — Bar + two lines

Installs as daily columns (rounded) with desktop and mobile lines (30-day variation)

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} aspectRatio="3 / 2" barGap={0} maxBarSize={20}>  <Grid horizontal />  <SeriesBar dataKey="installs" fill="var(--chart-3)" radius={5} />  <Line dataKey="desktop" stroke="var(--chart-1)" />  <Line dataKey="mobile" stroke="var(--chart-2)" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Trending up by 5.2% this month

Composed Chart — Markers & dashed tail

Ring markers and a dashed projection on the run-rate line and area stroke

<ComposedChart data={data} xDataKey="date" aspectRatio="3 / 2">  <Grid horizontal />  <SeriesBar dataKey="revenue" fill="var(--chart-1)" radius={4} />  <Area    dataKey="runRate"    dashArray="6,4"    dashFromIndex={4}    fill="var(--chart-4)"    fillOpacity={0.3}    showMarkers  />  <Line    dataKey="runRate"    dashArray="6,4"    dashFromIndex={4}    showMarkers    stroke="var(--chart-2)"    strokeWidth={2}  />  <ChartTooltip showCrosshair={false} />  <XAxis tickMode="data" /></ComposedChart>

Use dashFromIndex on Line and Area when projecting an incomplete final period

Composed Chart — Left Y axis

Bars and line share one left value scale with Y-axis labels

<ComposedChart data={data} xDataKey="date" margin={{ top: 8, right: 8, bottom: 40, left: 56 }} barGap={0} maxBarSize={32}>  <Grid horizontal />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={4} />  <Line dataKey="revenue" stroke="var(--chart-1)" />  <YAxis yAxisId="left" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Trending up by 5.2% this month

Composed Chart — Left and right Y axes

Units on the left scale, revenue line on the right (biaxial)

<ComposedChart data={data} xDataKey="date" margin={{ top: 8, right: 56, bottom: 40, left: 56 }} barGap={0} maxBarSize={32}>  <Grid horizontal />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={4} />  <Line dataKey="revenue" yAxisId="right" stroke="var(--chart-1)" />  <YAxis yAxisId="left" />  <YAxis yAxisId="right" orientation="right" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Trending up by 5.2% this month

Composed Chart - Pattern Background

Diagonal pattern fill instead of grid lines

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} xDataKey="date">  <Background />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={4} />  <Line dataKey="revenue" stroke="var(--chart-1)" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Use Background instead of Grid — see /docs/utility/background

Composed Chart - Dot Grid Background

Dot grid texture with edge fade

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} xDataKey="date">  <Background pattern="dots" opacity={0.85} />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={4} />  <Line dataKey="revenue" stroke="var(--chart-1)" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Trending up by 5.2% this month

Composed Chart - Reference Band

Horizontal Y band behind the series with dashed edges and bracket markers

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} xDataKey="date">  <ReferenceArea y1={95} y2={110} strokeStyle="dashed" showMarkers />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={4} />  <Line dataKey="revenue" stroke="var(--chart-1)" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

See /docs/utility/reference-area — tune bounds, fill, and markers in Studio

Composed Chart - Pattern Reference Band

Pattern fill inside the band with colored Y-axis tick labels

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} xDataKey="date">  <ReferenceArea    y1={95}    y2={110}    pattern="diagonal"    patternColor="var(--chart-foreground-muted)"    axisLabelColor="var(--chart-1)"    fillOpacity={0.85}  />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={4} />  <Line dataKey="revenue" stroke="var(--chart-1)" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Trending up by 5.2% this month

Composed Chart - Trend Line

Dashed least-squares trend line drawn over the series

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} xDataKey="date">  <Grid horizontal />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={4} />  <Line dataKey="revenue" stroke="var(--chart-2)" />  <TrendLine dataKey="revenue" stroke="var(--chart-1)" />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

See /docs/utility/trend-line — place TrendLine after the series so it draws on top

Composed Chart - Gradient Trend Line

Gradient stroke along the fit with faded ends

<ComposedChart margin={{ top: 8, right: 8, bottom: 40, left: 8 }} data={data} xDataKey="date">  <Grid horizontal />  <SeriesBar dataKey="units" fill="var(--chart-3)" radius={4} />  <Line dataKey="revenue" stroke="var(--chart-2)" />  <TrendLine    dataKey="revenue"    strokeStyle="gradient"    gradientStart="var(--chart-3)"    gradientEnd="var(--chart-1)"    strokeWidth={2.5}    fadeEdges  />  <ChartTooltip showCrosshair={false} />  <XAxis numTicks={8} /></ComposedChart>

Trending up by 5.2% this month