Brush
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
A zoom brush that filters the chart down to a draggable range of the data.
Usage
Add <EChartsAreaChart.Brush /> as a child of the chart root. Its presence renders the brush footer โ a miniature of the full dataset with a draggable selection window over it. Narrowing that window filters the main chart to the selected range; the miniature always keeps showing everything, so you never lose your place.
Set xDataKey on the root (or dataKey on <XAxis />) so the handles can label themselves with the category under each edge.
import { EChartsAreaChart } from "@/components/evilcharts/charts/echarts-area-chart";
<EChartsAreaChart data={data} config={chartConfig} xDataKey="date">
<EChartsAreaChart.XAxis dataKey="date" />
<EChartsAreaChart.Brush formatLabel={(value) => String(value)} />
<EChartsAreaChart.Area dataKey="desktop" variant="gradient" />
</EChartsAreaChart>;Example
Drag either handle to resize the range, or drag the selected region itself to pan without
changing its width. Handle labels fade in while the pointer is over the brush. Because the
ECharts brush is backed by a native dataZoom, the main plot is draggable too โ drag the chart
itself to slide the visible window, and the brush follows along.
Supported Charts
The brush is available on the cartesian charts โ EChartsAreaChart, EChartsLineChart, EChartsBarChart, and EChartsComposedChart. Attach it exactly the same way on each:
<EChartsLineChart.Brush />
<EChartsBarChart.Brush />
<EChartsComposedChart.Brush />The miniature mirrors the chart it belongs to. Area and composed charts draw filled areas, line charts draw strokes only, and bar charts draw rounded bars โ and it inherits the parent chart's stacking and series colors, dimming alongside the main plot when a series is selected.
The brush is hidden while the chart is in its loading state, and it never renders for the non-cartesian charts (pie, radar, radial, sankey), which have no continuous axis to zoom.
Reacting to the Range
Filtering the chart is automatic. Pass onChange when something outside the chart needs to follow along, such as a heading that reports the visible window:
const [range, setRange] = useState({ startIndex: 0, endIndex: data.length - 1 });
<EChartsAreaChart data={data} config={chartConfig} xDataKey="date">
<EChartsAreaChart.Brush onChange={setRange} />
<EChartsAreaChart.Area dataKey="desktop" variant="gradient" />
</EChartsAreaChart>;
// data[range.startIndex].date โ data[range.endIndex].dateonChange fires with data indices, not values, so look the labels up on your own rows.
How It Differs from Recharts
Same JSX, same props, same behavior โ but ECharts renders to a <canvas>, so the brush is built differently underneath. The miniature is a real second ECharts grid holding mirrored copies of every series. A fully transparent native dataZoom slider sits on top of it and supplies the drag interaction, while everything you actually see โ the rounded selection frame, the dimmed sides, the grip-dot handle pills, and the range labels โ is drawn as canvas elements that track the selection directly.
The practical differences: the main plot gains drag-to-pan for free, and the footer is a close reconstruction of the Recharts EvilBrush rather than a pixel-identical copy of it.
API Reference
Composed as a child of the chart root. It renders nothing itself โ its presence turns the brush footer on, and its props configure it.