Syncing charts
Share the crosshair and the visible range between charts.
Give charts the same syncId to share the crosshair position (by time, so charts with different data still line up).
Add syncRange to also pan and zoom them together.
"use client";
import { ChartCanvas, Pane } from "@reincharts/core";
import { AreaSeries, BarSeries } from "@reincharts/series";
import { Grid, XAxis, YAxis } from "@reincharts/axes";
import { Crosshair } from "@reincharts/coordinates";
import { Legend } from "@reincharts/tooltip";
import { traffic, type TrafficDay } from "@/lib/data-general";
import { useDocsChartTheme } from "@/lib/use-docs-theme";
export default function SyncedCharts() {
const theme = useDocsChartTheme();
return (
<div className="grid size-full grid-rows-2 divide-y divide-fd-border">
{/* same syncId → shared crosshair; syncRange → shared pan / zoom */}
<ChartCanvas data={traffic} theme={theme} syncId="docs-sync" syncRange barSpacing={6}>
<Pane>
<Grid />
<AreaSeries<TrafficDay> name="Sessions" y="sessions" />
<YAxis width={64} />
<Legend />
</Pane>
<Crosshair />
</ChartCanvas>
<ChartCanvas data={traffic} theme={theme} syncId="docs-sync" syncRange barSpacing={6}>
<Pane>
<Grid />
<BarSeries<TrafficDay> name="Sign-ups" y="signups" fill="#8b5cf6" />
<YAxis width={64} />
<Legend />
</Pane>
<XAxis />
<Crosshair />
</ChartCanvas>
</div>
);
}<ChartCanvas data={traffic} syncId="dashboard" syncRange>{/* ... */}</ChartCanvas>
<ChartCanvas data={breadth} syncId="dashboard" syncRange>{/* ... */}</ChartCanvas>Charts in the same page join a group by id; unmounting a chart leaves the group. Charts driven by another chart in the group show only the vertical crosshair line.
Multi-chart layouts
<TradingChart layout="4"> puts up to four charts in one widget ("2h", "2v", "3", "4"), each with its own
symbol, with crosshairs always synced and syncRange to pan and zoom them together.
See the multi-chart layouts example →
See Layouts & replay.