Secondary Y scale

Are you an AI agent?

Two unrelated measures on one pane — a price and its RSI, a request rate and its error rate. Each sits on its own Y scale with its own autoscale, and they share the time axis, the crosshair and the tooltip.

01 — NAME A SCALE
scales on the container declares named Y scales. Each one takes the same fields as axis.y — position, min / max, width, visible, a scale transform such as logScale(). position defaults to the side opposite the default axis. Keep the object stable: a changed scale refits.
const SCALES = { rsi: { position: 'left', min: 0, max: 100 } };
 
<ChartContainer scales={SCALES}>…</ChartContainer>
02 — PUT A SERIES ON IT
A line, bar, candlestick or band series opts in with scale. It autoscales on its own — here pinned to 0..100 — while the price keeps the default scale, and both share the time axis. A series without scale stays on the default scale.
<LineSeries id="price" data={price} />
<LineSeries id="rsi" scale="rsi" data={rsi} />
03 — GIVE IT AN AXIS
<YAxis scale="rsi" /> renders that scale's column; its format also drives the crosshair label on that side. One column fits on each side — visible: false makes an overlay scale with no column. Grid lines follow the default scale.
<YAxis />
<YAxis scale="rsi" format={(v) => v.toFixed(0)} />
04 — ANNOTATE IN ITS UNITS
ReferenceLine, Marker and YLabel take scale too. A YLabel follows its series' scale on its own and sits on that scale's side.
<ReferenceLine value={70} scale="rsi" label="overbought" />
<YLabel seriesId="rsi" />
6300063500640006450065000
020406080100
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
0123456789012345678901234567890123456789
22:3023:0023:3000:00
Chart: line, 493×412 px, time X axis. X: visible 2023-11-14T22:12:50Z – 2023-11-15T00:15:20Z; data 2023-11-14T22:13:20Z – 2023-11-15T00:12:20Z; step 1m. The view follows the newest point. Y: 62549.6 – 65379.2. Series: - price (line "BTC/USD"): 120 points, 120 in view, values 62683.7 – 65245.1, last 64876.4 at 2023-11-15T00:12:20Z - rsi (line "RSI 14"): 106 points, 106 in view, values 18.0609 – 80.9308, last 77.5723 at 2023-11-15T00:12:20Z Annotations: 0 marker(s), 0 region(s), 2 line(s).