Docs/Cartesian Components/Brush

Brush

Brush is an interactive control rendered below the plot area. Users drag the start and end handles (travellers) or the slide area to move the data window. This re-filters all graphical items to show only the selected range, making it easy to explore large datasets.

import { Brush, LineChart } from "solid-recharts";

<LineChart data={data}>
  <Brush dataKey="month" height={30} />
</LineChart>;
Brush
brush-basic.tsxOpen ↗
Loading source...

Props

PropTypeDefaultDescription
dataKeystring | number | function—Data field to label the brush ticks (optional)
heightnumber40Brush height in pixels
xnumberchart leftExplicit left position
ynumberbelow plotExplicit top position
widthnumberchart widthExplicit width
travellerWidthnumber5Handle width in pixels
startIndexnumber0Initial data start index
endIndexnumberlast indexInitial data end index
gapnumber1Index snapping step
fillstring"#fff"Slide background color
strokestring"#666"Border and handle color
dynumber0Extra vertical offset (pixels)
onChange(next) => void—Fired while dragging: {startIndex, endIndex}
onDragEnd(next) => void—Fired at drag release
alwaysShowTextbooleanfalseAlways show start/end tick labels
childrenJSX.Element—Panorama: graphical items to preview (optional)

Notes

  • Brush syncs with syncId on the chart; see LineChart for cross-chart linking.
  • dataKey labels the traveller ticks; omit to show indices.
  • children (panorama) renders a mini chart inside the brush showing the full data range — useful for previewing excluded data. Pass <Line>, <Bar>, etc.
  • onChange fires during drag; onDragEnd fires once at drag release.
  • Keyboard (arrow keys) and touch (swipe) input are supported.

See also