# Hooks & utilities
Source: https://react-native-livechart.brandtnewlabs.com/api-reference/hooks-and-utilities
LiveChartTransition, formatters, the mono font constant, and advanced hooks.
## LiveChartTransition
Cross-fades between chart instances by `key` — handy when switching symbols, timeframes, or
line/candle layouts.
```tsx theme={null}
import { LiveChartTransition, LiveChart } from "react-native-livechart";
;
```
**active** `string` *required*
Key of the active child to show. Must match a child's `key`.
**children** `ReactNode` *required*
Chart elements, each with a unique `key`.
**duration** `number` (default: 300)
Cross-fade duration in ms.
**keepMounted** `boolean` (default: false)
Keep every child mounted so switching is a pure cross-fade (no reveal/range re-animation).
Costs more — all engines run continuously.
**style** `ViewStyle`
Container style.
## Formatters
Both formatters are **worklet-safe**, so you can pass them to `formatValue` / `formatTime` or call
them inside your own worklets.
```tsx theme={null}
import { formatValue, formatTime } from "react-native-livechart";
formatValue(1234.5); // "1.23K" — adaptive compact suffixes (K / M)
formatValue(2_400_000); // "2.40M"
formatTime(1700000000); // "HH:MM:SS" in local time
```
**formatValue** `(v: number) =\> string`
Adaptive value formatter with compact `K` / `M` suffixes.
**formatTime** `(t: number) =\> string`
`HH:MM:SS` formatter for a unix-seconds timestamp.
## MONO\_FONT\_FAMILY
A platform-appropriate monospace family name (`"Menlo"` on iOS, `"monospace"` elsewhere) — useful
for matching surrounding RN `Text` to the chart's mono look.
```tsx theme={null}
import { MONO_FONT_FAMILY } from "react-native-livechart";
$142.50;
```
## Advanced hooks
> [!WARNING]
>
> `useDegen` and `useTradeStream` are **low-level** hooks that operate on the internal chart
> engine state. For almost all apps, use the [`degen`](/guides/momentum-and-degen) and
> [`tradeStream`](/guides/markers-and-trades) **props** on `LiveChart` instead — they wire
> these hooks up for you. The hooks are exported only for advanced custom compositions and their
> signatures depend on internal engine types.
## Experimental marker scheduling
The lower-level `useMarkers` hook accepts a final optional `autoSleep` boolean
(default `false`). When enabled, marker projection runs on changes to the marker
list, chart geometry, data, or frame gate instead of a continuous callback.
The `LiveChart.autoSleep` prop wires this automatically. Static mode still disables
marker projection. Most applications should use the component prop.
# LiveChart
Source: https://react-native-livechart.brandtnewlabs.com/api-reference/livechart
Props for the single-series line / candlestick component.
```tsx theme={null}
import { LiveChart } from "react-native-livechart";
```
`LiveChart` renders one series in line or candlestick mode. Props marked **required** must be
provided; everything else has a default.
## Series opacity
**seriesOpacity** `SharedValue\` (default: 1)
A UI-thread opacity multiplier for the plotted data. Set it to `0.5` while
replacement history loads, then restore it to `1` when the new data arrives.
It affects the line and area fill, candles and volume bars, value line, badge,
and inline value text—not axes, reference lines, or scrub UI. While it is below
`1`, the live dot and pulse ring fade completely out so the stroke cannot show
through the dot; they fade back in after the multiplier returns to `1`.
See [Dimming replacement data](/guides/line-and-area#dimming-replacement-data).
## Data
**data** `SharedValue\` *required*
Growing array of `{ time, value }` points. Read on the UI thread.
**value** `SharedValue\` *required*
Latest live value, interpolated between data updates.
## Display mode
**mode** `"line" | "candle"` (default: "line")
Line/area or OHLC candlestick rendering.
**candles** `SharedValue\`
Committed OHLC bars, sorted by `time` (candle mode).
**candleWidth** `number`
Seconds per candle bucket (e.g. `60` for 1-minute bars).
**liveCandle** `SharedValue\`
In-progress candle, updated each tick; `null` between buckets.
**candleGaps** `CandleGap[] | CandleGapsConfig` (default: off)
Explicit no-trade, unavailable, or unknown candle intervals. The library never
infers their meaning from sparse timestamps and never inserts synthetic OHLC.
See [Chart gaps](/guides/empty-candles).
**lineGaps** `ChartGap[] | ChartGapsConfig` (default: off)
Explicit no-trade, unavailable, or unknown line intervals. The line and every
area fill stop at empty interval boundaries; bridge-enabled kinds draw an
independently styled previous-value segment. Real samples take precedence.
See [Chart gaps](/guides/empty-candles).
**volume** `boolean | VolumeConfig` (default: false)
Volume bars in a reserved band below the candles (candle mode only). The
candle plot shrinks by the band height so candles are never cut off; the x-axis
stays pinned to the bottom. Reads each [`CandlePoint.volume`](/api-reference/types#data);
bars normalize to the largest visible volume. Pass a
[`VolumeConfig`](/api-reference/types#config-objects) for `upColor` / `downColor`,
`maxHeight`, `radius`, `opacity`. See [Candlestick](/guides/candlestick#volume-bars).
## Line, fill & tip
**line** `LineConfig`
Main line styling: `width`, `color`, plus shape controls — `curve`
(`"monotone"` smooth default | `"linear"` straight segments), `join`
(`"round"` | `"miter"` | `"bevel"`), and `cap` (`"round"` | `"butt"` |
`"square"`). `simplify` is an opt-in screen-space path tolerance in pixels;
start around `0.75`–`1.5` to remove sub-pixel noise without changing the
source data, fitted range, markers, or scrub values. See
[Line denoising](/guides/line-denoising). Pair `curve: "linear"` with
`join: "miter"` + `cap: "butt"` for a fully hard-edged ("edgy") line.
`color` also accepts a `SharedValue` to animate the stroke and the
built-in scrub selection dot. See [Line & area](/guides/line-and-area#animating-the-line-and-fill-color)
for an example and the [`LineConfig`](/api-reference/types#config-objects)
for fallback behavior.
**gradient** `boolean | GradientConfig` (default: true)
Area fill under the line. Pass a `GradientConfig` with `colors` (≥ 2 stops, top
→ bottom) for a custom multi-color fill; otherwise the fill is derived from the
accent color. `colors` also accepts a `SharedValue` to animate the
fill stops. See [Line & area](/guides/line-and-area#animating-the-line-and-fill-color)
for an example; keep at least two stops in the shared value.
**areaDots** `boolean | AreaDotsConfig` (default: false)
Dot-lattice fill of the area beneath the line — a screen-fixed grid of dots
clipped to the region between the line and the baseline. Composes with
`gradient` (both paint) or replaces it (`gradient={false}`). Pass an
`AreaDotsConfig` to tune `spacing`, `size`, `color`, and `opacity`; the color
defaults to a faint tint of the line/accent color. Inert in candle mode.
**badge** `boolean | BadgeConfig` (default: true)
Value badge pill at the tip. Pass a [`BadgeConfig`](/api-reference/types) to
shape it — `radius` (escape the capsule), `borderColor` / `borderWidth`,
`textColor`, per-badge `fontSize` / `fontFamily` / `fontWeight`, and
`offsetX` / `offsetY`. All are Skia-native and drawn in the batched canvas
pass, so there's no per-frame view cost. `textAlign: "yAxisColumn"` lines the
value up with a right-anchored Y-axis label column. See [Theming → Customizing
the badge](/guides/badge-styling).
**pulse** `boolean | PulseConfig` (default: true)
Pulsing ring on the live dot.
**dot** `boolean | DotConfig` (default: true)
Live dot styling. Pass `false` to hide the dot, or a `DotConfig` for `radius`,
`ring` (the crisp contrasting backing, on by default), opt-in `glow`, and
`color`. `glow: true` enables restrained defaults, or pass a `DotGlowConfig`
to tune `color`, `radius`, `blur`, and `opacity`. It is independent from
the animated `pulse` prop and starts no animation clock. The same `DotConfig`
is shared with `LiveChartSeries` (whose `dot` extends it with `pulse`,
`valueLine`, and `valueLabel`). `dot={false}` is the canonical "hide" — the
deprecated `dot={{ show: false }}` still works. With `timeScroll`,
`trackWhileParked` keeps the dot on the **true live point** while scrolled
back — it tracks the point's x, keeps its pulse, and hides once the point
leaves the window (ignored with `badge.followViewEdge`). See
[Time-scroll](/guides/time-scroll#keep-the-dot-on-the-live-point-dottrackwhileparked).
**valueLine** `boolean | ValueLineConfig`
Horizontal dashed line at the current value.
**showValue** `boolean` (default: false)
Render the live value as large top-left text.
**valueMomentumColor** `boolean` (default: false)
Tint the `showValue` text by momentum (green up / red down).
## Momentum & degen
**momentum** `boolean | "up" | "down" | "flat" | MomentumConfig` (default: true)
Momentum-based dot/badge coloring. See [Momentum & degen](/guides/momentum-and-degen).
**degen** `boolean | DegenOptions`
Particle burst + screen shake on momentum swings.
**onDegenShake** `(payload: DegenShakePayload) =\> void`
JS-thread callback when a degen shake starts.
## Trades, markers & references
**tradeStream** `SharedValue\`
Live trade fills for on-chart markers.
**markers** `SharedValue\`
Glyph markers drawn into the canvas (UI-thread read).
**onMarkerPress** `(event: MarkerPressEvent | null) =\> void`
Fires when a marker is tapped; `null` on a miss. When a collapsed cluster (count
badge) is tapped, `event.isGrouped` is `true` and `event.members` lists the
cluster's markers.
**markerHitRadius** `number` (default: 16)
Tap hit-test radius in px.
**markerCluster** `"anchored" | "stacked" | MarkerClusterConfig` (default: "anchored")
Collision handling for co-located markers. `"anchored"` (default) keeps today's
behavior — glyphs draw at their anchor and overlap. `"stacked"` fans co-located
markers apart horizontally (overlapping, left-over-right) along their
[`side`](/api-reference/types#annotations), collapsing a cluster into a single
count-badge marker once it exceeds `maxBeforeGroup`. Grouping is recomputed per
frame, so a cluster fans back out as you zoom/scroll in. Pass a
[`MarkerClusterConfig`](/api-reference/types#annotations) object to tune the
`overlap` (`0`–`1`, default `0.75`) and `maxBeforeGroup` (default `5`):
```tsx theme={null}
markerCluster={{ overlap: 0.75, maxBeforeGroup: 8 }}
```
For `direction: "vertical"`, `maxVisible` caps the column while preserving the
oldest glyphs nearest the line; newer overflow is hidden. It defaults to
unbounded. `maxBeforeGroup` still runs first, so set it higher than the burst
you want to cap instead of collapse:
```tsx theme={null}
markerCluster={{ direction: "vertical", maxBeforeGroup: 20, maxVisible: 8 }}
```
**Custom collapsed look** — by default a collapsed group draws a round count
badge (`groupBadge: "count"`). Two ways to customize it:
* `groupBadge: "marker"` — draw the **representative marker's own glyph** (its
`image` / `icon` / `pill` / `kind`), e.g. a run of buy pills → a buy pill.
* `groupBadge: { image }` (or `{ icon, pill, color }`) — a **dedicated badge you
supply** ([`MarkerGroupBadge`](/api-reference/types#config-objects)), independent
of the members — e.g. tiny dots that collapse into a distinct "Buy 5" image.
Add `showGroupCount` to stamp the member count in the glyph's corner. All are
Skia-drawn in the same batch as every other marker (not a `renderMarker` RN
overlay).
```tsx theme={null}
markerCluster={{ mode: "stacked", groupBadge: { image: buy5Badge }, showGroupCount: true }}
markerCluster={{ mode: "stacked", groupBadge: { letterSpacing: 1 } }}
```
**renderMarker** `(marker: Marker, ctx: MarkerRenderContext) =\> ReactElement | null`
Render a marker as a custom **React Native** element instead of a built-in Skia
glyph — e.g. an `expo-blur` glass badge or any non-Skia view. Return an element
to float it, auto-centered, at the marker's live `(time, value)` position
(tracked on the UI thread); return `null`/`undefined` to keep the built-in
glyph. The second argument carries cluster/position state
(`{ index, isGrouped, groupCount, side }`) — e.g. render a distinct collapsed
look when `ctx.isGrouped`. Custom-rendered markers skip the atlas (no
double-draw) and stay crisp at native resolution. Use sparingly — each is its
own animated view, whereas built-in glyphs batch into one draw call. See
[Custom marker rendering](/guides/markers-and-trades#custom-marker-rendering).
**renderTooltip** `(ctx: TooltipRenderProps) =\> ReactElement | null`
Render a fully custom scrub tooltip as a **React Native** element instead of the
built-in pill — the same idea as `renderMarker`. The chart floats it over the
canvas and positions it on the UI thread (per `scrub.tooltipPlacement`); you own
the chrome (border radius/color, background are plain RN styles) and content. Bind
the [`TooltipRenderProps`](/api-reference/types#tooltiprenderprops) `SharedValue`s
to animated text so the value/date update on the UI thread too — smooth, unlike
rebuilding the tooltip from the JS-thread `onScrub`. Return `null`/`undefined` to
hide the custom tooltip; it does not restore the built-in pill. Works in line
and candle mode (`ctx.candle` supplies OHLC). Enable `scrub.markers` to read
matching trades through `ctx.markers`, including their `data`.
See [Custom tooltip](/guides/scrubbing#custom-tooltip-rendertooltip).
**renderOverlay** `(ctx: ChartOverlayContext) =\> ReactElement | null`
Render a custom overlay floated over the canvas, handed the price↔pixel /
time↔pixel bridge so it can track the **auto-rescaling** axis on the UI thread —
the same idea as `renderMarker`. The
[`ChartOverlayContext`](/api-reference/types#chartoverlaycontext) gives you a
per-frame `scale` `SharedValue` plus pure `priceToY` / `yToPrice` / `timeToX` /
`xToTime` mapping worklets. Easiest: render a component per level and call
[`usePriceY(ctx, price)`](/api-reference/types#chartoverlaycontext) /
`useTimeX(ctx, time)` — each returns a `SharedValue` that tracks the axis,
which you read in `useAnimatedStyle`. (Or take the manual path: read `scale.get()`
in the worklet, then feed the snapshot to the mappings.) Return any RN view tree
(order / avg-entry / liquidation price tags, custom level lines); return
`null`/`undefined` for no overlay. The tree mounts full-bleed with
`pointerEvents="box-none"` so empty areas still scrub. Available on both
`LiveChart` and `LiveChartSeries`. See [Overlay bridge](/guides/overlay-bridge).
**referenceLines** `ReferenceLine[]`
Reference lines / bands (horizontal line, time-varying `series`, value band, or
time band). Series lines work in both line and candle mode. Their first value
extends to the visible window start unless `extendToStart` is `false`, and their
last value extends to the live edge unless `extendToNow` is `false`. Form-A lines
can be `draggable` (drag to set a price, with `snap` / `bounds` and `onChange` /
`onCommit` / `onDragIn` / `onDragOut` callbacks). See
[Reference lines](/guides/reference-lines-and-bands).
Form-A lines also support `valueBadge: true` for a separate price pill inside
the right plot edge, or `{ position: "axis" }` for the price column. Both pills
follow dragging on the UI thread and collapse together when grouped. See
[Separate price pills](/guides/reference-lines-and-bands#separate-price-pills-valuebadge).
**renderReferenceLine** `(ctx: ReferenceLineRenderProps) =\> ReactElement | null`
Render a reference line's tag as a custom **React Native** element instead of the
built-in Skia pill / gutter label — the same model as `renderMarker` /
`renderTooltip`. The chart floats it over the canvas and pins it to the line's
value on the UI thread (see
[`ReferenceLineRenderProps`](/api-reference/types#annotations)), so it tracks the
rescaling axis and any drag without JS re-renders. Called per Form-A line; return
`null` to keep that line's built-in tag (works with `badge: false` too).
A left- or right-pinned badge keeps its built-in dashed connector, which starts
after the measured custom view. Single-series only.
**renderOffAxisReferenceLine** `(ctx: ReferenceLineRenderProps) =\> ReactElement | null`
Replace only a Form-A line's **off-axis** tag with a React Native element. The
standard Skia tag or gutter label remains visible in range; the custom view takes
over only when the value is pinned above or below the plot. A left- or
right-pinned `badge` (or legacy `offAxisBadge`) keeps its native dashed connector,
beginning after the measured custom view. Return `null` for lines that opt out;
use `ctx.edge` inside the returned component to animate a directional caret. See
[Reference lines](/guides/reference-lines-and-bands#off-axis-only-custom-tags-renderoffaxisreferenceline).
**referenceLineGrouping** `boolean | ReferenceLineGroupingConfig` (default: false)
Collapse Form-A lines whose handles sit near the same value into a single count
handle — a stack of working orders at adjacent prices reads as one tag. Pass an
object to tune the proximity `radius` (px). Single-series only.
Badged lines above or below the visible range group at the nearest plot edge.
Off-axis lines with no badge are hidden and do not count; custom tags are excluded
from collapse. Use `{ mode: "stack" }` to keep each tag, including measured custom
tags, and separate overlapping columns without moving price strokes. Stacking
avoids the visible live badge by default (`avoidValueBadge: false` opts out).
`radius` is then a minimum center gap, with measured heights plus 2 px taking
precedence. Count-pill `badge` and `format` apply only to collapse.
See [stacking tags](/guides/reference-lines-and-bands#stacking-tags).
**segments** `ChartSegment[]`
Labeled time-range segments (sessions, after-hours, overnight) with
**scrub-focus**: at rest the line is one uniform color; while scrubbing — or
when a segment is `active` — the focused segment keeps the base color and every
other segment is de-emphasized (`mutedColor` / `mutedColors`) by recoloring the
line stroke itself, not an overlay. Optional dashed `divider` + `label` mark a
segment's edge. See [Segments](/guides/segments) and
[`ChartSegment`](/api-reference/types#chartsegment). Single-series only.
**threshold** `ThresholdConfig`
Color the line above vs. below a live threshold value — green above, red below
by default. Use a live scalar `SharedValue`, a `LiveChartPoint[]`
history, or a live `SharedValue` series.
Optionally adds a tinted profit/loss `fill` band and a dashed marker `line`; a
series marker badge can independently select its
horizontal `labelPosition` and first/last visible `labelAnchor`. Set
`extendToStart: false` when the threshold did not exist before its first point.
Supersedes `line.color`/`colors` and segment recoloring for the main stroke while set. See
[`ThresholdConfig`](/api-reference/types#thresholdconfig). Single-series,
line mode only.
**renderThresholdBadge** `(ctx: ThresholdBadgeRenderProps) =\> ReactElement | null`
Replace the built-in Skia threshold pill with a custom **React Native**
element. The chart measures it and pins it to the threshold's live Y position
and `threshold.line.labelPosition` on the UI thread; the dashed marker line
remains native. The context exposes `value`, `valueStr`, `y`, and `visible`
SharedValues plus the resolved line config. Return `null`/`undefined` to keep
the built-in badge. Requires `threshold.line`. See
[Custom threshold badge](/guides/threshold#custom-threshold-badge).
## Scrubbing
**scrub** `boolean | ScrubConfig` (default: true)
Set `markers: true` (or `{ radius: 24 }`) to include marker details in
`renderTooltip` and `onScrub`. Off by default. See
[Inspecting markers while scrubbing](/guides/markers-and-trades#inspecting-markers-while-scrubbing).
Crosshair scrubbing on drag. `crosshairFadeDistance` controls the visible
line/dot/tooltip fade near the live edge, and `crosshairLineCap` selects a
`"butt"`, `"round"`, or `"square"` vertical-line cap. See
[Scrubbing](/guides/scrubbing#crosshair-width-line-cap-overshoot-and-edge-fade).
**selectionDot** `boolean | SelectionDotConfig` (default: true)
Dot drawn at the scrub intersection while scrubbing. `false` hides it; pass a
config to set `size` / `color` / `ring`, or `{ component }` for a fully custom
Skia dot. See [Scrubbing](/guides/scrubbing#selection-dot).
**onScrub** `(point: ScrubPoint | null) =\> void`
Fires on the JS thread while scrubbing; `null` when it ends. With
`scrub.markers` enabled, `point.markers` contains all timestamp matches,
including `data`, or `[]` when none match. Omitted when disabled. Marker
payloads are transferred only when the selection or marker input changes;
callbacks for subsequent scalar point updates reuse that selection.
When marker matching is enabled, entering a region with no valid price also
sends `null` to clear an external trade readout.
**onScrubCandleChange** `(candle: CandlePoint | null) =\> void`
Fires on the JS thread with an OHLC snapshot when the crosshair enters a
different candle, including revisits. Updates within the same candle do not
fire it. Sends `null` on scrub end, entering a gap, or leaving candle mode;
otherwise idle in line mode. See
[Scrubbing](/guides/scrubbing#per-candle-callback-onscrubcandlechange).
**scrubAction** `boolean | ScrubActionConfig` (default: false)
**Order-ticket** mode: tap to drop a locked crosshair, drag to fine-tune a
**price level**, then press the right-gutter action badge to fire `onScrubAction`.
The reported price is the value at the reticle's **Y** (a free level you choose),
not the line value at that time. Coexists with `scrub`. Pass a
[`ScrubActionConfig`](/api-reference/types#config-objects) for `icon`, colors,
`snap`, `text: false` (icon-only), or `timeBadge` (an x-axis date/time pill, off by
default). See [Order ticket](/guides/order-ticket).
Single-series only.
**onScrubAction** `(point: ScrubActionPoint) =\> void`
JS-thread callback fired when the action badge is pressed. `point.price` is the
chosen price level (reticle Y, optionally `snap`-rounded). See
[`ScrubActionPoint`](/api-reference/types#scrub-payloads).
**onGestureStart** `() =\> void`
JS-thread callback fired once when the user starts scrubbing. Respects
`scrub.panGestureDelay` (it fires when the pan activates, not on first touch).
**onGestureEnd** `() =\> void`
JS-thread callback fired once when the user stops scrubbing. Fires only if a
scrub actually started — a tap that never activates emits neither callback.
**timeScroll** `boolean | TimeScrollConfig` (default: false)
Pan back through history: drag (or fling) to scroll, and the chart stops
auto-following until you return to the live edge. Setting it back to `false`
while scrolled back — or switching `mode` so it's no longer passed — glides the
window back to the live edge (eased, not an instant jump; never frozen at the
old position).
`true` uses the default drag-to-scroll gesture (`"holdToScrub"` — drag scrolls,
press-and-hold scrubs); pass a
[`TimeScrollConfig`](/api-reference/types#config-objects) to pick `"axisDrag"`
(drag the x-axis strip), set `scrubHoldMs`, set
`hideLiveOnScrollBack: false` to keep the live badge, dot, and value line visible
while scrolled back (hidden by default — they mark the off-screen live price), or
set `overscroll` to drag past the data bounds into blank space
(TradingView-style; default `0` — hard stops).
With `viewport`, disabling this gesture preserves the supplied position.
**@experimental.** See [Time-scroll](/guides/time-scroll).
**returnToLive** `boolean | ReturnToLiveConfig` (default: true)
Controls the glide back to the live edge when `timeScroll` is switched off while
scrolled back. `true` (default) eases onto live over `450` ms; `false` snaps
instantly; `{ duration }` sets a custom glide length (ms). Kept separate from
`timeScroll` so it survives `timeScroll={false}` (the toggle that triggers it).
Does not clear or animate an app-owned `viewport` when gestures are disabled.
**@experimental.** See
[Time-scroll → Turning it back off](/guides/time-scroll#turning-it-back-off).
**zoom** `boolean | ZoomConfig` (default: false)
Pinch-to-zoom the visible time window. Two-finger pinch in/out narrows or
widens the window, anchored at the focal point between your fingers. Composes
with `timeScroll` (zoom level and scroll position are independent). `true` uses
sensible default bounds; pass a [`ZoomConfig`](/api-reference/types#config-objects)
to set `minTimeWindow` / `maxTimeWindow`. **@experimental.** See
[Time-scroll](/guides/time-scroll#pinch-to-zoom-zoom).
**priceScroll** `boolean | PriceScrollConfig` (default: false)
Drag the plot vertically to move the price window; with `timeScroll` this gives
free X/Y panning (a diagonal drag moves both axes). Requires `timeScroll` in its
default `"holdToScrub"` gesture. `true` uses `activation: "afterScale"`: a
vertical drag pans only once the range was manually changed by a price-axis
drag (`yAxis.scaleGesture`), a pinch, or an earlier price pan, so an untouched
chart still hands vertical drags to a parent `ScrollView`. Pass a
[`PriceScrollConfig`](/api-reference/types#config-objects) for
`activation: "always"` or to set `maxOvershoot` (travel past the fitted range in
visible spans; default `1`). The pan writes `viewport.range` (your shared value
when `viewport` is supplied, private state otherwise); the engine keeps that
range while following live and clamps it to `nonNegative`, `maxValue` and
`minRange`. Price-axis drags then scale the panned window in place; an axis
double tap, `resetView()`, or a `snapKey` / `mode` change clears it. No release
momentum. Writing new app bounds or replacing `viewport.range` relinquishes
gesture ownership; those bounds retain the app-controlled contract and are
preserved by resets and framing changes. **@experimental.** See
[Time-scroll → Price panning](/guides/time-scroll#price-panning-pricescroll).
**resetButton** `boolean | ResetButtonConfig` (default: false)
Float a reset-view button inside the plot while the view differs from the
fitted live view (scrolled back, pinched, scaled or price-panned) and hide it
while scrubbing. A tap runs the same reset as `resetView()`. `true` places a
round glyph button at `"bottom-center"`; pass a
[`ResetButtonConfig`](/api-reference/types#config-objects) for
`"bottom-right"`, `showFor`, `margin`, fade and the built-in look. The tap is
composed ahead of the plot gestures, so it never delays scrub, pan or pinch.
**@experimental.** See [Reset view](/guides/reset-view).
**renderResetButton** `(props: ResetButtonRenderProps) =\> ReactElement`
Custom visual for `resetButton`. The chart still owns placement, visibility, the
fade and the tap, so return a plain view (not a pressable) and wire `reset` to
`onAccessibilityTap` on iOS and an `activate` accessibility action on Android
for screen readers. Receives `visible` and `reset`. See
[Reset view → Custom button](/guides/reset-view#custom-button).
**onResetView** `() =\> void`
JS-thread callback fired after the reset button or `resetView()` applies its
reset overrides on the UI thread. Return animations may still be running.
**viewport** `false | ViewportConfig` (default: false)
Pass a [`ViewportConfig`](/api-reference/types#config-objects) object to enable
external control; `false`/omitted keeps private gesture state. Both shared values
are required, so there is no `true` shorthand.
Adopt external shared values for the right edge (`end`, unix seconds) and width
(`window`, seconds). Null means follow this chart's live edge / `timeWindow`.
Pan and pinch write the same pair; `resetZoom()` clears both. Non-null values
survive `timeWindow` changes, disabled `timeScroll`, and overscroll-setting changes.
An external end may exceed this chart's live edge; an end before its first retained
point falls back to live unless valid `range` bounds are supplied. Writes work with gestures
disabled and wake `autoSleep` charts.
Optional `range` is a shared value containing `{ min, max }` or `null`. While `end`
is finite and non-null, valid bounds apply immediately, including in empty space.
Bounds and their difference must be finite, with `min < max`; invalid/null/omitted
bounds use automatic fitting. Explicit bounds override automatic fitting, range
easing, `nonNegative`, `maxValue`, `minRange`, and `yRangeScale`. `resetZoom()`
leaves `range` intact but clears `end`, making those bounds inactive.
In line mode, the line and live dot end at the last recorded point. The badge and
value line use that recorded price, and a live dot outside the window hides.
Plain scrub clamps to that latest recorded point. If it leaves the window to
the left, the scrub hides and `onScrub` clears until recorded data re-enters.
`badge.followViewEdge` pins indicators to the edge only when the latest recorded
point leaves the visible time window.
`windowSmoothing: false` adopts a non-null width immediately, useful for followers
copying an already-drawn width. Default `true`; null still eases back to `timeWindow`.
Single-series line/candle only. **@experimental.** See
[Synced charts](/guides/synced-charts).
### Resetting the view
Attach a `ref` typed as [`LiveChartHandle`](/api-reference/types#imperative-handle) and call
`ref.current?.resetZoom()` from a button or any other outside event. It returns the visible width
to `timeWindow`, clears the focal-point offset, and resumes following the live edge. The reset is
scheduled on the UI thread and is safe when the chart is already reset. A paused chart remains
paused. See [Time-scroll → Reset zoom from a button](/guides/time-scroll#reset-zoom-from-a-button).
`ref.current?.resetView()` goes further: it also returns `yRangeScale` to `1` and clears a price
range written by `priceScroll` or the axis-scale gesture, gliding the right edge back with the
`returnToLive` timing. It is what the floating `resetButton` runs. See
[Reset view](/guides/reset-view).
**onVisibleRangeChange** `(range: VisibleRange) =\> void`
Called as the visible window changes (throttled to \~1 Hz) with
`{ startSec, endSec, following }`. Useful for paging a data source alongside
`timeScroll` / `zoom`. **@experimental.**
**onReachStart** `() =\> void`
Called once when the window's left edge comes within one window-width of the
earliest retained data — the cue to lazily load older history. Re-arms after
the edge moves back out. **@experimental.**
## Axes, grid & range
**xAxis** `boolean | XAxisConfig` (default: true)
Time-axis labels. Pass `{ minGap }` to set their minimum pixel spacing
(default `60`). Changing the gap updates the labels immediately, even while paused.
Pass `{ gridLines: true }` for vertical grid lines at the labels, drawn behind
the series in the `gridStyle` look, or a `GridStyleConfig` to restyle them
(omitted fields fall back to `gridStyle`). Strokes stay within the plot width,
including while a departing time label fades into a gutter. See
[Vertical grid lines](/guides/axes-and-grid#vertical-grid-lines).
**yAxis** `boolean | YAxisConfig` (default: true)
The centered right gutter re-measures after the first finite, nonzero live
value and subsequent factor-of-ten moves. With `labelRightMargin`, it uses
actual painted tick widths plus the edge margin, dot-effect outset and six
points of clearance; React layout updates only when width changes. Badge
reservations still apply. `insets.right` overrides automatic sizing.
Opt into vertical price-axis dragging with `{ scaleGesture: true }`, or pass
`YAxisScaleGestureConfig` for bounds, sensitivity, and double-tap reset. It
writes `yRangeScale` when supplied, otherwise an internal multiplier. Off by
default; see [Y-range scaling](/guides/y-range-scale).
Value-axis grid + labels. Set `{ side: "left" }` and reserve label space with
`insets.left` for left-side labels; the default side is `"right"`. Pass `{ count }` for a fixed number of evenly-spaced
prices instead of the dynamic nice-interval grid. Pass `{ intervalScale }`
with a matching `formatValue` multiplier to choose nice intervals in display
units without changing plotted values. Scales that would make the current
display range overflow or underflow fall back to source-unit intervals. Use
`{ labelRightMargin, gridEndGap }` for a fixed right-anchored label column and
deterministic gap between labels and grid/plain reference lines; the
right-gutter live badge can line its value up with that column
(`badge={{ textAlign: "yAxisColumn" }}`).
**axisAutoHide** `boolean | AxisAutoHideConfig` (default: false)
Fade the X and Y axes (grid, ticks, and labels) out while the chart is idle,
then show them for scrubbing, panning, fling momentum, price-axis scaling, and pinch zoom. `true`
uses the default timing; pass
[`AxisAutoHideConfig`](/api-reference/types#config-objects) to set the fade
durations, idle opacity, and idle delay. **Experimental; `LiveChart` only.**
See [Axis auto-hide](/guides/axis-auto-hide).
**topLabel** `boolean | AxisLabelConfig` (default: false)
Edge label floated at the plot's **top**. `true` shows the built-in value
label — the chart's current top Y-axis bound, formatted and updated each frame
(Robinhood-style high). Pass [`AxisLabelConfig`](/api-reference/types#axislabelconfig)
to set `format` / `color` / `position`, or `{ render }` to float a fully custom
element instead. See [Axis labels](/guides/axes-and-grid#axis-edge-labels).
**bottomLabel** `boolean | AxisLabelConfig` (default: false)
Edge label floated at the plot's **bottom**. `true` shows the built-in value
label — the chart's current bottom Y-axis bound (the low) — with the same
`AxisLabelConfig` knobs and `render` escape hatch as `topLabel`.
**gridStyle** `GridStyleConfig`
Grid-line color / width / dash / opacity.
**timeWindow** `number` (default: 30)
Visible window in seconds.
**paused** `boolean` (default: false)
Freeze scrolling; resume catches up to real time.
**loading** `boolean | LoadingConfig`
Breathing-line loading shell until data is ready. `true` uses the defaults; pass
a [`LoadingConfig`](/api-reference/types#loadingconfig) to restyle it (`color`,
`strokeWidth`, `amplitude`, `speed`, `axisLabels` to toggle the skeleton
Y-axis placeholders, and `freezeAfterMs` to freeze the squiggle after a
while — see [States & formatting](/guides/states-and-formatting#freezing-the-wave)).
`false` / omitted is "not loading". Entering loading or
empty snaps immediately; the loading→live grow-in duration is set via the
`transitions` prop below — see
[Transitions](/guides/transitions).
**transitions** `boolean | TransitionConfig`
Tune or disable the built-in transition animations. `true` / omitted keeps the
defaults; `false` makes them instant (no grow-in when data appears or the
timeframe changes, no candle↔line crossfade, candle width snaps); leaving
live data for loading/empty already snaps; a
[`TransitionConfig`](/api-reference/types#config-objects) sets per-transition
durations in ms — `reveal` (default `600`) and `mode` (default `300`), `0` to
snap — plus `candleLerpSpeed` (default `0.08`, `1` = instant), the per-frame
speed at which candle bodies resize when `candleWidth` changes (a timeframe /
bucket switch). Live value tracking is governed separately by `smoothing`, and
static-entry suppression by `static`. See [Transitions](/guides/transitions).
**static** `boolean` (default: false)
Render once with no per-frame animation loops — engine, degen, trades, candles,
markers, pulse, and entry reveal are all disabled. `scrub` / `scrubAction` stay
available, though: they're on-demand touch gestures with no per-frame cost, so a
still chart costs nothing at rest yet is still scrubbable on touch. Keeps many
small charts cheap when you render a list or grid of sparklines. You can toggle
it at runtime; switching back to live restarts the suspended loops and catches
up. Frame the data edge-to-edge with `timeWindow` + `nowOverride`. See the
[Sparklines guide](/guides/sparklines).
Data, layout, `timeWindow`, and `nowOverride` changes re-settle without restarting
the loop. Entering static mode lands on the new window even when data and
framing change in the same render, as in a recycled list cell.
**autoSleep** `boolean` (default: false)
Experimental, single-series sleep/wake scheduling. Paused, parked, and fixed-time
charts stop requesting engine frames after settling for 160 ms. Data, layout,
range, theme, and gesture changes wake the engine on the UI thread. Candle width
settles on demand; marker positions update when their inputs change.
Live scrolling and configured pulse, degen, trade-stream, loading, and empty
effects keep it awake. `static` takes priority; the manual frame gate still applies.
This does not cache a bitmap or stop Reanimated-owned overlay animations.
See [Historical data](/guides/historical-data#experimental-automatic-sleep).
**isFrameLoopActive** `SharedValue\`
Runtime gate for continuous frame work. Set it to `false` while a parent list
scrolls; data can still update, and the chart catches up when it becomes
`true`. The chart and its gestures stay mounted. Unlike `static`, this can be
changed on the UI thread without a React render. Experimental; see
[Scroll interaction](/guides/scroll-interaction).
**debugFrameStats** `SharedValue\`
Optional development counter with `frames`, `published`, and `skipped` totals
for active engine callbacks. A gated frame is not counted. `published` tracks
changes to engine values, not every possible Skia redraw. The counter itself
writes a SharedValue each frame, so omit it from production profiling.
Experimental; see [Scroll interaction](/guides/scroll-interaction).
**smoothing** `number` (default: 0.08)
Value-lerp speed (0 = frozen, 1 = instant).
**rangeAnimation** `RangeAnimationConfig`
Control Y-range easing independently of live-value and time-window smoothing.
`animateExpansion` defaults to `false` (outward bounds snap); set it to `true`
to ease expansion. `expansionSmoothing` and `contractionSmoothing` independently
override the per-60fps-frame fraction of the remaining gap closed; omitted
speeds inherit `smoothing`. Finite overrides clamp to 0..1, and non-finite
overrides inherit `smoothing`. This is frame-rate-independent exponential
easing, not a duration in milliseconds.
While the fitted and displayed ranges do not overlap, contraction is limited
to the animated expansion speed so the bounds cannot cross.
`smoothing: 1`, `snapKey` changes, static mode, and active manual Y-scale dragging
remain immediate. Axis-label fades stay under `metrics.grid`. Shared with
`LiveChartSeries`; see [Y-range animation](/guides/y-range-scale#animating-automatic-range-changes)
and [`RangeAnimationConfig`](/api-reference/types#rangeanimationconfig).
**snapKey** `string | number`
Snap the framing (time window, Y-range, value) to its target in one frame
whenever this key changes — **without** giving up smooth live ticks. On a
timeframe / dataset switch the framing otherwise eases over `smoothing`, which
reads as a slide; bump `snapKey` (e.g. to the current timeframe id, or a counter
you increment when swapping `data` / `candles`) and the next frame jumps to the
new framing, then normal `smoothing` resumes. Unlike `transitions` (opacity only)
and `static` (no live loop), this settles only the geometry and only for one
frame. See [Transitions](/guides/transitions#snap-on-a-timeframe-or-data-change).
**exaggerate** `boolean` (default: false)
Tight Y-axis so small moves fill the height.
**nonNegative** `boolean` (default: false)
Clamp the Y-axis lower bound at 0. When [`yRangeScale`](#param-y-range-scale)
zooms out, expansion stops when that floor is reached, keeping the data
centered rather than growing only upward.
**maxValue** `number`
Hard upper bound for the Y-axis range.
**minRange** `number`
Minimum auto-fitted Y span in data units, giving near-flat data room for
distinct formatted labels. `nonNegative` and `maxValue` shift the span;
when both leave less room than the floor, the hard bounds win. Positive
finite values only; invalid or overflowing floors are ignored. Manual
`yRangeScale` applies afterward and may go below the floor. Normal range
easing applies, and static charts re-settle on changes. Shared with
`LiveChartSeries`. See [Minimum Y range](/guides/minimum-range).
**yRangeScale** `SharedValue\` (default: 1)
The built-in `yAxis.scaleGesture` writes this SharedValue when supplied; omit
it to let that gesture use chart-owned state. Disabling the gesture preserves
the current multiplier.
Manual Y-range multiplier around the fitted midpoint (`1` = auto-fit). Drive
it from a gesture (e.g. dragging the price axis) to stretch or compress the
price scale TradingView-style; the auto-fit keeps tracking the visible window
underneath. Values must be positive and finite; invalid values safely fall
back to `1`. On a `nonNegative` chart, zoom-out stops at the zero floor.
Series drawing is clipped vertically to the price plot, above the automatically
reserved candle-volume band, so values outside the visible range cannot cover
the time labels. An explicit bottom inset keeps its existing layout override.
Read on the UI thread each frame. Static single-series charts re-settle when
this SharedValue changes without replacing data. Shared with `LiveChartSeries`.
**@experimental.** See
[Manual Y-range scaling](/guides/y-range-scale).
**windowBuffer** `number` (default: 0)
Right-edge buffer as a fraction of `timeWindow`.
In line mode, a positive buffer leaves empty space after the last recorded point;
the line and dot end there, and the badge/value line use that recorded price.
Plain scrub also clamps to that latest recorded point so a held crosshair cannot
read empty future space. If the point leaves the window to the left, the scrub
hides and `onScrub` clears until recorded data re-enters. `badge.followViewEdge`
pins indicators to the edge only when the latest recorded point leaves the
visible time window. Candle indicators continue to use candle prices.
**nowOverride** `number`
Override the engine's "now" (unix seconds) — useful for historical playback.
## Theming & layout
**canvasMode** `"transparent" | "opaque"` (default: "transparent")
Experimental canvas composition mode. On Android, `"transparent"` uses Skia's default
TextureView path; `"opaque"` owns and paints the palette background and selects SurfaceView.
Keep the default when content behind the chart must remain visible. Profile release builds on
physical hardware before enabling broadly. See [Android surface rendering](/guides/android-surface-rendering).
**theme** `"light" | "dark"` (default: "dark")
Color scheme.
**accentColor** `string` (default: "#3323E6")
Primary accent; the palette is derived from it.
**palette** `Partial\`
Override individual resolved-palette keys.
**metrics** `LiveChartMetricsOverride`
Sizing & motion tokens — the geometry/feel analogue of `palette`. Namespaced
(`badge`, `candle`, `grid`, `motion`, `emptyState`); only the keys you set are
replaced. See the [Theming guide](/guides/theming#sizing-and-motion-tokens) and
[`LiveChartMetrics`](/api-reference/types).
**font** `FontConfig`
Font family / size / weight / custom typeface for all chart text.
**leftEdgeFade** `boolean | LeftEdgeFadeConfig` (default: true)
Soft fade on the left edge.
**insets** `ChartInsets`
Padding for the drawing area (`top`, `right`, `bottom`, `left`).
**style** `ViewStyle`
Container `View` style.
## Text & accessibility
**formatValue** `(v: number, tickStep?: number) =\> string`
Worklet formatter for value labels. Y-axis ticks pass their interval in source
units as `tickStep`, including fixed-count ticks. Badges, tooltips and layout
samples omit it. Existing one-argument formatters remain valid.
**formatTime** `(t: number) =\> string`
Formatter for time labels.
**emptyText** `string` (default: "No data")
Label shown when there are no samples and `loading` is false. A single line point or
committed candle is valid data and renders normally.
**accessibilityLabel** `string`
Accessibility label for the chart container.
**accessibilityRole** `"image" | "none" | "adjustable" | "summary"` (default: "image")
Accessibility role for the container.
> [!NOTE]
>
> Config-object types (`LineConfig`, `BadgeConfig`, `DegenOptions`, `ReferenceLine`, etc.) are
> documented in the [Types reference](/api-reference/types).
# LiveChartSeries
Source: https://react-native-livechart.brandtnewlabs.com/api-reference/livechart-series
Props for the multi-series line component.
```tsx theme={null}
import { LiveChartSeries } from "react-native-livechart";
```
`LiveChartSeries` draws several line series sharing an axis, time window, and crosshair. It
accepts all the shared theming, axis, range, layout, and text props from
[`LiveChart`](/api-reference/livechart) (`theme`, `accentColor`, `palette`, `metrics`, `font`,
`canvasMode`, `timeWindow`, `smoothing`, `rangeAnimation`, [`snapKey`](/api-reference/livechart#param-snap-key),
[`yRangeScale`](/guides/y-range-scale), [`minRange`](/api-reference/livechart#param-min-range), `line`, `yAxis`, `xAxis`,
`referenceLines`, `formatValue`, …), plus the multi-series props below.
`formatValue(value, tickStep?)` receives the source-unit interval for Y-axis
ticks, letting compact labels adapt precision. Badges and tooltips omit the
second argument; one-argument formatters remain compatible.
The inherited `yAxis.intervalScale` chooses dynamic nice intervals in display units without
changing any series values. Pair it with a `formatValue` that applies the same multiplier. If the
scaled live range cannot be represented, interval selection safely falls back to source units.
Live price changes use `smoothing` even when the newest recorded point already
equals `SeriesConfig.value`. The dot and newest drawn sample ease together;
source history and recorded scrub values remain unchanged. Earlier samples keep
their recorded geometry. `smoothing={1}` and `snapKey` still settle immediately.
On Android, the shared experimental `canvasMode="opaque"` option selects an opaque SurfaceView and
paints the palette background inside the canvas. See
[Android surface rendering](/guides/android-surface-rendering) for constraints and profiling guidance.
`yAxis={{ side: "left" }}` also places multi-series Y-axis labels in the gutter
reserved by `insets.left`; right-side series value labels remain unchanged.
Centered right-gutter sizing samples the largest finite absolute series value,
skipping zero and invalid placeholders. It re-measures after the first real value
and subsequent factor-of-ten moves. `insets.right` overrides automatic sizing;
see [Axes & grid](/guides/axes-and-grid).
With `yAxis.labelRightMargin`, automatic padding instead measures the actual
tick column on the UI thread, reserving its width, edge margin, the largest
dot/pulse/glow outset and six points of clearance. React layout updates only
when width changes. Inline labels and axis badges may need extra space;
`insets.right` remains authoritative.
## Presentation clock
**presentationTime** `SharedValue\`
UI-thread presentation head in Unix seconds. The engine reads it every frame;
`undefined` falls back to `nowOverride` or wall time. Scrub time limits use the
same clock. Lines, live dots, value lines and inline labels project at
`min(viewportEnd, head)`, keeping `windowBuffer` free of future price samples.
Parked viewports retain the presented value when their edge passes the head.
Scrub callbacks, selection dots and tooltip interpolation exclude future samples;
momentum bursts originate at the projected dot and hide when it is offscreen.
An already-recorded value at or before this explicit head is presented immediately,
avoiding a second layer of live-feed tip easing. Paths and range fitting exclude
samples after an explicit head. Updating the
SharedValue does not require a React render. See
[Replay clock](/guides/multi-series#replay-clock).
## Growing history window
**historyStartTime** `number`
Authoritative history start in Unix seconds. While following without a zoom
override, `window = (now - historyStartTime) / (1 - windowBuffer)` keeps this
timestamp at the left edge as time advances. Use `0 <= windowBuffer < 1`.
Pan freezes the edge and unzoomed width; pinch overrides remain active.
`ref.current?.resetZoom()` restores the growing live window. Default zoom-out
bounds include this full span, even when the retained first sample starts later.
Non-finite or future starts fall back to `timeWindow`. See
[All history](/guides/multi-series#all-history).
## Series opacity
**seriesOpacity** `SharedValue\` (default: 1)
A UI-thread opacity multiplier for every plotted series. Set it to `0.5`
while replacement history loads, then restore it to `1` when the new data
arrives. It dims strokes, value lines, and inline value labels without
affecting axes, the legend, reference lines, or scrub UI. Live dots and pulse
rings fade completely out while the multiplier is below `1`, then fade back in
once it returns to `1`, avoiding translucent dots over their own strokes. See
[Dimming replacement data](/guides/multi-series#dimming-replacement-data).
## Manual Y-range scaling
**rangeAnimation** `SeriesRangeAnimationConfig`
Ease the shared fitted Y-range independently of series-tip and time-window
smoothing. The first measured, visible data fits immediately, including when
it arrives after an empty mount. `animateExpansion: true` opts into outward easing
for subsequent updates;
`expansionSmoothing` and `contractionSmoothing` override each direction's
per-60fps-frame speed (0..1). Omitted speeds inherit `smoothing`. Omission of
the config preserves instant expansion and eased contraction. `smoothing: 1`,
explicit `snapKey` changes, and active `yRangeScale` dragging remain immediate.
While the fitted and displayed ranges do not overlap, contraction is limited
to the animated expansion speed so the bounds cannot cross.
Custom overlays keep following the animated `ChartOverlayContext.scale`.
An optional `transform` worklet receives `{ min, max, from, to }` after fitting
and easing. Return finite increasing `{ min, max }` presentation bounds; invalid
results are ignored. The untransformed fit is retained separately, so expansions
never accumulate and removing the callback restores it. The callback may read
SharedValues and receives the visible Unix-second interval. Hard bounds apply
to the underlying fit before transforming. See the
[overlay range example](/guides/multi-series#transforming-the-presentation-range).
See [Y-range animation](/guides/y-range-scale#animating-automatic-range-changes)
for a hold/release example without a return timer.
**yAxis** `boolean | YAxisConfig` (default: true)
Inherits the value-axis configuration. Opt into vertical axis dragging with
`{ scaleGesture: true }` or customize it with `YAxisScaleGestureConfig`.
Touches use the actual left/right gutter and right-anchored price column;
the optional `yRangeScale` is shared by all visible series. See
[Y-range scaling](/guides/y-range-scale).
**yRangeScale** `SharedValue\` (default: 1)
`yAxis.scaleGesture` writes this SharedValue, or uses an internal multiplier
when omitted. Disabling the gesture preserves the current multiplier.
Multiplies the shared fitted Y-range around its midpoint. Drive it from a
price-gutter gesture to stretch or compress every visible series together;
hidden series remain excluded from the underlying fit. Values must be positive
and finite, and invalid values safely behave as `1`. With the inherited
`nonNegative` prop, zoom-out stops at the zero floor. Read on the UI thread
each frame. Series strokes are clipped vertically to the price plot while dots
and value labels retain their own placement. **@experimental.** See
[Manual Y-range scaling](/guides/y-range-scale).
## Custom overlays
**renderOverlay** `(ctx: ChartOverlayContext) =\> ReactElement | null`
Render a full-bleed custom React Native overlay with the live price↔pixel /
time↔pixel bridge. [`ChartOverlayContext`](/api-reference/types#chartoverlaycontext)
includes the resolved plot rectangle, so custom off-axis tags and connectors can
stop at the same axis inset as the chart. Return `null` or `undefined` for no
overlay. See [Overlay bridge](/guides/overlay-bridge).
## Reference-line tags
Horizontal `referenceLines` support `valueBadge: true` or
`valueBadge: { position: "axis" }` for a second, formatted-price pill. The same
[style and placement rules](/guides/reference-lines-and-bands#separate-price-pills-valuebadge)
apply; this does not add single-series dragging, grouping, or press callbacks to
`LiveChartSeries`.
**renderReferenceLine** `(ctx: ReferenceLineRenderProps) =\> ReactElement | null`
Replace a Form-A reference line's built-in Skia badge or gutter label with any
React Native element. Return `null` or `undefined` for per-line fallback to the
built-in tag. The custom view tracks the line's live Y position, pins to the
nearest plot edge when off-axis, and respects left, center, and right badge
positions. A left- or right-pinned badge keeps its dashed connector, beginning
after the measured custom view. The reference-line stroke remains visible. See
[Reference lines and bands](/guides/reference-lines-and-bands#custom-tags-renderreferenceline).
`ctx.tagOffsetY` is always zero on `LiveChartSeries`; reference-tag grouping and stacking are single-series features.
**renderOffAxisReferenceLine** `(ctx: ReferenceLineRenderProps) =\> ReactElement | null`
Replace only an off-axis Form-A tag. The standard Skia tag or gutter label stays
in range, while the custom React Native view takes over when the line is pinned
above or below the plot. A left- or right-pinned `badge` (or legacy
`offAxisBadge`) retains its dashed connector from the custom view's measured
edge. Return `null` for lines that opt out, and use `ctx.edge` inside the
returned component for a directional caret. See
[Reference lines and bands](/guides/reference-lines-and-bands#off-axis-only-custom-tags-renderoffaxisreferenceline).
## Series data
**series** `SharedValue\` *required*
Array of series definitions. Read on the UI thread. Each series can override
the shared `line.simplify` screen-space tolerance with `simplify`; `0` disables
simplification for that series. See [Line denoising](/guides/line-denoising)
and [`SeriesConfig`](/api-reference/types).
## Axis labels
Shared with [`LiveChart`](/api-reference/livechart#axes-grid-range). Both
default off.
**topLabel** `boolean | AxisLabelConfig` (default: false)
Edge label at the plot's top. `true` shows the built-in value label — the
chart's current top Y-axis bound, updated each frame. Pass
[`AxisLabelConfig`](/api-reference/types#axislabelconfig) (`format` / `color` /
`position`) or `{ render }` for a custom element.
**bottomLabel** `boolean | AxisLabelConfig` (default: false)
Edge label at the plot's bottom (the current bottom Y-axis bound), with the
same options as `topLabel`.
## Legend
**legend** `boolean | LegendConfig` (default: true)
Toggle chips. Configure `position`, `compact`, and `style`.
**onSeriesToggle** `(id: string, visible: boolean) =\> void`
Fires when a legend chip is tapped.
## Dots
**dot** `boolean | MultiSeriesDotConfig` (default: true)
Per-series live dots: `radius`, `ring`, opt-in static `glow`, `color`,
`pulse`, `valueLine`, and `valueLabel`. The crisp contrasting outer `ring`
is on by default; `glow` is off by default and accepts `color`, `radius`,
`blur`, and `opacity`. Pass `ring: false` for a flat circle, `dot={false}`
to hide the dots, or `color` to override the per-series fill. (The deprecated
`dot={{ show: false }}` still hides them.)
## Scrub
**scrub** `boolean | ScrubConfig` (default: true)
`markers: true` (or `{ radius: 24 }`) adds timestamp-matched markers to
`onScrub`. Off by default; see [Marker inspection](/guides/markers-and-trades#inspecting-markers-while-scrubbing).
Crosshair scrubbing on drag. **As of v2 this defaults to `true`** (it previously
defaulted to `false`); pass `scrub={false}` to disable. The existing default is
a guide/dim layer. Omitting `seriesTooltip` (or setting it to `false`) preserves
that behavior. Set `scrub.seriesTooltip` to opt into the Morfi-style
time-range pill, one colour/value pill and intersection dot per visible series,
collision stacking, and edge flipping. `seriesTooltip.alwaysShow` keeps value
pills pinned to the visible endpoints while idle without showing the guide or
time pill. The existing `scrub.tooltip={false}` switch remains the master
tooltip control and also suppresses the per-series pills. See
[Multi-series tooltips](/guides/multi-series#per-series-scrub-tooltip).
`crosshairFadeDistance` and `crosshairLineCap` style the visible guide,
selection dot, and tooltip consistently with `LiveChart`.
**selectionDot** `boolean | SelectionDotConfig` (default: false)
Dot drawn at the scrub intersection while scrubbing. **Hidden by default on
`LiveChartSeries`** (unlike `LiveChart`): with multiple lines the dot can only
track the leading series, so the crosshair and the opt-in tooltip's per-series
intersection dots mark the scrub point instead. Pass `true` to opt in (it anchors to the leading series),
a config to set `size` / `color` / `ring`, or `{ component }` for a fully
custom Skia dot. See [Scrubbing](/guides/scrubbing#selection-dot).
**onScrub** `(point: ScrubPointMulti | null) =\> void`
**Worklet** callback fired on the UI thread each frame while scrubbing; `null` when it ends.
Includes a per-series value array. With `scrub.markers` enabled it also
includes `point.markers` (all matches, including their `data`, or `[]`). The
field is omitted when disabled. See [Scrubbing](/guides/scrubbing).
With marker matching enabled, a valid point becoming unavailable sends `null`.
**onGestureStart** `() =\> void`
JS-thread callback fired once when the user starts scrubbing. Respects
`scrub.panGestureDelay` (it fires when the pan activates, not on first touch).
**onGestureEnd** `() =\> void`
JS-thread callback fired once when the user stops scrubbing. Fires only if a
scrub actually started — a tap that never activates emits neither callback.
**timeScroll** `boolean | TimeScrollConfig` (default: false)
With `gesture: "axisDrag"`, the bottom time-axis strip is reserved for scrolling
and excluded from scrub recognition, including stationary holds.
Pan back through history (same as `LiveChart`). Drag (or fling) to scroll; the
chart stops auto-following until you return to the live edge. Setting it back to
`false` while scrolled back glides the window back to the live edge (eased, not
an instant jump; never frozen at the old position). Per-series dots / value
labels track each series' value at the visible right edge while scrolled. Pass
a [`TimeScrollConfig`](/api-reference/types#config-objects) with `overscroll`
to pan or pinch past the oldest data and live edge into blank space
(TradingView-style; default `0` keeps the hard stops).
**@experimental.** See [Time-scroll](/guides/time-scroll).
**returnToLive** `boolean | ReturnToLiveConfig` (default: true)
Controls the glide back to live when `timeScroll` is switched off while scrolled
back (same as `LiveChart`). `true` (default) eases over `450` ms, `false` snaps
instantly, `{ duration }` sets a custom length. Sibling of `timeScroll` so it
survives `timeScroll={false}`. **@experimental.** See
[Time-scroll → Turning it back off](/guides/time-scroll#turning-it-back-off).
**zoom** `boolean | ZoomConfig` (default: false)
Pinch-to-zoom the visible window (same as `LiveChart`), anchored at the focal
point. Composes with `timeScroll`. **@experimental.** See
[Time-scroll](/guides/time-scroll#pinch-to-zoom-zoom).
Attach a `ref` typed as [`LiveChartHandle`](/api-reference/types#imperative-handle) and call
`ref.current?.resetZoom()` to return the shared window to `timeWindow` (or the growing `historyStartTime` span) and the live edge. This is
the same imperative reset exposed by `LiveChart`. See
[Time-scroll → Reset zoom from a button](/guides/time-scroll#reset-zoom-from-a-button).
`ref.current?.resetView()` additionally eases `yRangeScale` back to `1`. `priceScroll` and
`resetButton` are `LiveChart` only. See [Reset view](/guides/reset-view).
**onVisibleRangeChange** `(range: VisibleRange) =\> void`
Called as the visible window changes (\~1 Hz) with `{ startSec, endSec,
following }`. **@experimental.**
**onReachStart** `() =\> void`
Called once when the left edge nears the earliest retained data — the cue to
page in older history. **@experimental.**
## Degen
**degen** `boolean | DegenOptions`
Chart shake + spark burst off the leading series' dot on an upward swing.
**onDegenShake** `(payload: DegenShakePayload) =\> void`
JS-thread callback when a degen shake starts.
# Types
Source: https://react-native-livechart.brandtnewlabs.com/api-reference/types
Exported TypeScript types — data shapes, config objects, and the palette.
All types are exported from the package root:
```tsx theme={null}
import type {
CandleGap,
CandleGapsConfig,
ChartGap,
ChartGapsConfig,
LiveChartHandle,
LiveChartFrameStats,
LiveChartPoint,
ReferenceLine,
SeriesConfig,
} from "react-native-livechart";
import type { SharedValue } from "react-native-reanimated";
```
The source `.d.ts` and JSDoc remain the canonical reference (your editor surfaces them on hover);
the most-used shapes are reproduced here.
## Data
```ts theme={null}
type CanvasMode = "transparent" | "opaque";
```
`CanvasMode` controls whether the Skia canvas participates in transparent composition or owns its
background. On Android, opaque mode selects SurfaceView. See
[Android surface rendering](/guides/android-surface-rendering).
```ts theme={null}
interface LiveChartPoint {
time: number; // unix seconds
value: number;
}
interface CandlePoint {
time: number; // bucket start, unix seconds
open: number;
high: number;
low: number;
close: number;
volume?: number; // optional traded volume; drives the volume bars (candle mode)
}
type CandleGapKind = "no-trades" | "unavailable" | "unknown";
interface CandleGap {
from: number; // inclusive, unix seconds
to: number; // exclusive, unix seconds
kind: CandleGapKind;
label?: string;
}
// Renderer-neutral aliases used by lineGaps. The candle names remain available.
type ChartGapKind = CandleGapKind;
type ChartGap = CandleGap;
interface SeriesConfig {
id: string;
data: LiveChartPoint[];
value: number; // latest live value; smoothing eases the live dot and
// newest drawn sample together, even when recorded.
// Source history stays unchanged. An explicit
// presentationTime uses already-recorded values immediately.
color?: string;
label?: string;
visible?: boolean; // default true
style?: "solid" | "dashed";
intervals?: [number, number];
curve?: "monotone" | "linear"; // interpolation; default "monotone"
simplify?: number; // per-series path tolerance in px; inherits line.simplify
strokeWidth?: number;
glow?: boolean;
kind?: "outcome" | "derived";
valueLabel?: string;
}
```
Both chart components accept these shared opacity and range controls:
```ts theme={null}
interface LiveChartCoreProps {
// UI-thread value from 0 (hidden) to 1 (fully visible); default 1.
seriesOpacity?: SharedValue;
// Minimum auto-fitted span in data units; positive and finite, omitted by default.
minRange?: number;
nonNegative?: boolean;
maxValue?: number;
yRangeScale?: SharedValue;
}
```
`seriesOpacity` dims plot data (line and area fill, candles, value lines, badges,
and inline values) without dimming axes, legends, reference lines, or scrub UI.
While it is below `1`, live dots and pulse rings fade completely out so a dimmed
stroke cannot show through them; they return once the multiplier reaches `1`.
See [Line & area](/guides/line-and-area#dimming-replacement-data) or
[Multi-series](/guides/multi-series#dimming-replacement-data).
`minRange` widens a narrower bounded fit, shifting off zero or the ceiling.
Hard bounds win if the floor cannot fit; invalid or overflowing floors are
ignored. Manual `yRangeScale` applies afterward and can zoom below the floor.
See [Minimum Y range](/guides/minimum-range) for the interactive comparison.
The experimental frame-loop controls are available on `LiveChart`:
```ts theme={null}
interface LiveChartFrameStats {
frames: number; // active engine callbacks
published: number; // callbacks that changed a tracked engine value
skipped: number; // callbacks whose tracked engine values were unchanged
}
interface LiveChartProps {
autoSleep?: boolean; // experimental; default false; single-series only
isFrameLoopActive?: SharedValue;
debugFrameStats?: SharedValue;
}
```
See [Scroll interaction](/guides/scroll-interaction) for the parent-scroll gate
and the counter's measurement limits.
## Momentum
```ts theme={null}
type Momentum = "up" | "down" | "flat";
interface MomentumConfig {
threshold?: number; // default 0.12
lookback?: number; // default 20
}
```
## Annotations
```ts theme={null}
type MarkerKind = "trade" | "boost" | "graduation" | "winner" | "clawback";
interface Marker {
id: string;
time: number; // unix seconds
kind: MarkerKind;
seriesId?: string; // anchor to a series line (multi-series)
value?: number; // absolute y (takes precedence over seriesId)
color?: string;
icon?: string; // text/emoji glyph override
image?: SkImage; // image glyph override
pill?: boolean; // draw the icon in a filled circular badge
size?: number; // default 16
side?: "above" | "below" | "center"; // sit off the anchor (default "center")
data?: unknown; // surfaced on onMarkerPress and opt-in scrub matches
}
// Fires on tap (there is no hover on touch); `null` on a miss.
interface MarkerPressEvent {
marker: Marker;
point: { x: number; y: number };
index: number; // index in the markers array
isGrouped: boolean; // true when a collapsed cluster (count badge) was tapped
members?: Marker[]; // the cluster's markers when isGrouped
}
// Second argument to renderMarker — cluster / position state.
interface MarkerRenderContext {
index: number;
isGrouped: boolean;
groupCount: number;
side: "above" | "below" | "center";
}
// Object form of the `markerCluster` prop (tunes stacked collision). Passing it
// implies mode: "stacked" unless you set mode explicitly.
interface MarkerClusterConfig {
mode?: "anchored" | "stacked";
direction?: "horizontal" | "vertical"; // fan sideways (default) or pile into a column
overlap?: number; // 0 (touching) – 1 (stacked); default 0.75
maxBeforeGroup?: number; // collapse a run past this many; default 5
maxVisible?: number; // vertical columns only: keep this many oldest glyphs; default unbounded
groupBadge?: "count" | "marker" | MarkerGroupBadge; // collapsed look: count circle
// (default), the representative marker's own glyph, or a
// dedicated custom badge you supply (object form)
showGroupCount?: boolean; // with a non-count badge, stamp the count in the corner; default false
}
// Badge options for a collapsed cluster. Use letterSpacing by itself to tune the
// built-in count, or add image/icon for a dedicated glyph. @experimental
interface MarkerGroupBadge {
letterSpacing?: number; // extra px between count digits; default 0
image?: SkImage; // custom Skia image (precedence over icon)
icon?: string; // text/emoji glyph (when image unset)
color?: string; // icon / pill color; defaults to a palette accent
pill?: boolean; // wrap the icon in a filled circular badge
size?: number; // glyph box size in px; default 16
}
interface TradeEvent {
side: "buy" | "sell";
price: number;
size: number;
time: number; // unix seconds
symbol?: string;
}
interface ReferenceLine {
id?: string; // stable identity; supply when lines may reorder
// removal/reindexing cancels the current drag; no commit
// Form A — horizontal line:
value?: number;
// Form B — time-varying line (sorted unix-second points):
series?: LiveChartPoint[];
extendToStart?: boolean; // flat-extend the first value left; default true
extendToNow?: boolean; // flat-extend the last value to live; default true
// Form C — horizontal band:
valueFrom?: number;
valueTo?: number;
// Form D — vertical time band (unix seconds):
from?: number;
to?: number;
// Shared:
label?: string;
strokeWidth?: number;
intervals?: [number, number];
color?: string;
fillColor?: string; // band fill; defaults to color, then palette refLine
fillOpacity?: number; // default 0.16
strokeOpacity?: number; // line / series / band-border opacity; default 1
fullWidth?: boolean; // span edge-to-edge through the Y-axis gutter (Form A/C);
// label/badge stay in the plot. default false
labelColor?: string;
labelPosition?: "left" | "center" | "right";
showValue?: boolean;
excludeFromRange?: boolean;
// Pill badge for a Form-A line (working orders, alerts, targets) — pinned to an
// edge with a dashed connector; auto-pins with a chevron when off-screen:
badge?: boolean | ReferenceLineBadgeConfig;
valueBadge?: boolean | ReferenceLineValueBadgeConfig; // separate formatted price; default false
badgeBackground?: string; // fallback for badge.background; default theme tooltipBg
badgeBorderColor?: string; // fallback for badge.borderColor; default the line color
badgeRadius?: number; // fallback for badge.radius; default 5
// Legacy off-axis badge (prefer `badge`, which also shows in-range + supports an icon):
offAxisBadge?: boolean;
offAxisBadgeLabel?: string;
// Draggable (Form A only) — grab the line and drag it along the Y-axis:
draggable?: boolean; // default false
grabRange?: [number, number]; // canvas x px where a press may grab it; default anywhere
snap?: number; // tick increment; draw/drop inside the visible edges when a tick fits;
// round the finger's value outward past the plot to widen the range
bounds?: [number, number] | SharedValue<[number, number]>; // hard-clamp the draggable value;
// a SharedValue follows a live bound on the UI thread
onChange?: (value: number) => void; // as the finger moves it (de-duped); + once on release if the line ended elsewhere
onCommit?: (value: number) => void; // on release — pair with a controlled `value`
onDragIn?: (value: number) => void; // value entered the visible range / bounds
onDragOut?: (value: number) => void; // value left the visible range / hit a bound
}
interface ReferenceLineBadgeConfig {
position?: "left" | "center" | "right"; // edge to pin to ("center" floats at the
// value, no connector); default "left"
icon?: string; // leading glyph (chart font), like Marker.icon
text?: boolean; // show the label/value; default true. false → icon-only
background?: string; // falls back to badgeBackground, then theme tooltipBg
borderColor?: string; // falls back to badgeBorderColor, then the line color
borderWidth?: number; // border stroke width; default 1
radius?: number; // corner radius; falls back to badgeRadius, then 5
textColor?: string; // label/icon color; falls back to labelColor, then theme
fontSize?: number; // badge font size; falls back to the chart font
fontFamily?: string; // badge font family; falls back to the chart font
fontWeight?: FontWeight; // badge font weight; falls back to the chart font
offsetX?: number; // nudge the whole badge from its anchor; default 0
offsetY?: number; // nudge the whole badge from its anchor; default 0
}
// Shared background/border/radius/textColor/font*/offset* knobs; defaults match
// reference-line badges. Independent of the name badge's styling.
interface ReferenceLineValueBadgeConfig extends BadgeStyleConfig {
position?: "right" | "axis"; // inside plot (default) or right price column
}
interface ReferenceLineRenderProps {
line: ReferenceLine; // the line being rendered
index: number; // its index in `referenceLines`
value: SharedValue; // live Y-axis value (tracks dragging)
valueStr: SharedValue; // value formatted with the chart's formatValue
y: SharedValue; // canvas Y px of the line (-1 when not laid out)
tagOffsetY: SharedValue; // stacking displacement; wrapper applies it automatically
inRange: SharedValue; // whether the value is within the visible range
edge: SharedValue<"above" | "in" | "below">; // for a directional off-axis chevron
dragging: SharedValue; // whether this line is currently being dragged
}
// `renderReferenceLine` replaces both built-in pills in every state. `renderOffAxisReferenceLine`
// keeps the built-in in-range tag and shows the custom element only for edge !== "in".
interface ReferenceLineGroupingConfig {
// Off-axis badge / offAxisBadge tags group at either plot edge. Hidden plain
// off-axis lines do not count. Custom tags are excluded from collapse only.
mode?: "collapse" | "stack"; // default "collapse"; stack includes measured custom tags
avoidValueBadge?: boolean; // stack only: avoid the visible live badge; default true
radius?: number; // collapse proximity or minimum stacked center gap; default 18
badge?: ReferenceLineBadgeConfig; // count-pill styling (same style/shape config as a
// per-line badge: position, icon, colors, radius,
// border, textColor, font, offset)
format?: (count: number) => string; // label the count, e.g. n => `×${n}`; default String(n)
}
interface ChartSegment {
from?: number; // unix seconds; omit → chart's left edge
to?: number; // unix seconds; omit → live edge (now)
// Scrub-focus line styling (the headline interaction):
recolorLine?: boolean; // join scrub-focus dimming; default true. false → line
// never dims (divider/label still draw); behaves as a gap
mutedColor?: string; // de-emphasis color when NOT focused; default: palette.gridLabel
// (an alpha color, e.g. "rgba(154,160,166,0.4)", fades the line)
mutedColors?: string[]; // ≥2 → de-emphasis gradient; precedence over mutedColor
active?: boolean; // force-focus this segment without scrubbing; default false
// Divider + label (colors inherit the chart palette — no base color needed):
divider?: boolean; // dashed vertical line at `from`; default false
dividerColor?: string; // default: palette.refLine
label?: string; // caption — shown only with the divider; drawn in palette.refLabel
labelPosition?: "left" | "right"; // default "left"
}
```
## Scrub payloads
```ts theme={null}
interface ScrubPointCore {
markers?: Marker[]; // present with scrub.markers; [] when no matches
time: number;
value: number;
x: number; // canvas X
y: number; // canvas Y
}
interface ScrubPoint extends ScrubPointCore {
candle?: CandlePoint; // candle mode only
gap?: ChartGap; // line or candle mode, when a bridged declared gap supplies value
}
interface ScrubPointMulti extends ScrubPointCore {
seriesValues: { id: string; label?: string; value: number }[];
}
// Payload for onScrubAction (order-ticket mode). `price` is the value at the
// reticle Y — a chosen level — not the line value at that time.
interface ScrubActionPoint {
price: number; // reticle-Y value, optionally snap-rounded
time: number; // unix seconds at the reticle X
x: number; // canvas X
y: number; // canvas Y
candle?: CandlePoint; // candle mode only — OHLC under the reticle X (context)
}
```
`LiveChart` exposes these JS-thread callbacks:
```ts theme={null}
interface LiveChartProps {
// null when the gesture ends or a selected recorded tip leaves a buffered/controlled window.
onScrub?: (point: ScrubPoint | null) => void;
// OHLC snapshot on candle entry/re-entry; null on exit, gap, or leaving candle mode.
onScrubCandleChange?: (candle: CandlePoint | null) => void;
}
```
The per-candle callback does not stream updates within the same candle. For
continuously updated OHLC, use `onScrub` or the UI-thread `renderTooltip` values.
See [Candle feedback](/guides/candle-feedback) for the interactive comparison.
## Config objects
These are the option shapes accepted by the matching props.
```ts theme={null}
interface CandleGapBridgeStyle {
color?: string;
opacity?: number;
strokeWidth?: number;
strokeCap?: "butt" | "round" | "square";
}
interface CandleGapBandStyle {
fillColor?: string;
fillOpacity?: number;
borderColor?: string;
borderOpacity?: number;
borderWidth?: number;
intervals?: [number, number];
}
interface CandleGapLabelStyle {
color?: string;
position?: "left" | "right";
}
interface CandleGapStyle {
bridge?: false | CandleGapBridgeStyle;
band?: false | CandleGapBandStyle;
label?: false | CandleGapLabelStyle;
}
interface CandleGapsConfig {
gaps: CandleGap[];
styles?: Partial>;
}
type ChartGapBridgeStyle = CandleGapBridgeStyle;
type ChartGapBandStyle = CandleGapBandStyle;
type ChartGapLabelStyle = CandleGapLabelStyle;
type ChartGapStyle = CandleGapStyle;
type ChartGapsConfig = CandleGapsConfig;
interface LineConfig {
width?: number; // stroke width in px; default 2
color?: string | SharedValue; // line color override; defaults to palette
// accent. A SharedValue animates the stroke and the built-in
// selection dot on the UI thread; a custom selection dot,
// segment base, area-dot tint, and threshold rest color then
// use the palette line color
colors?: string[];// per-point gradient stops (left → right); wins over color
curve?: "monotone" | "linear"; // point interpolation; default "monotone"
// (smooth cubic). "linear" = straight segments / hard-edged.
simplify?: number; // screen-space path tolerance in px; default 0 (off).
// Removes only intermediate drawn points within the tolerance;
// source data, axis fitting, markers, and scrubbing stay exact.
join?: "round" | "miter" | "bevel"; // corner join; default "round".
// "miter" = sharp/angular peaks, "bevel" = flattened.
cap?: "round" | "butt" | "square"; // start/end cap; default "round".
// pair "butt" + join "miter" for a fully hard-edged line.
}
interface GradientConfig {
topOpacity?: number; // accent-derived top fill opacity
bottomOpacity?: number; // accent-derived bottom fill opacity
colors?: string[] | SharedValue; // explicit gradient stops (top →
// bottom), ≥ 2 entries; overrides topOpacity/
// bottomOpacity when provided. A SharedValue animates
// the stops on the UI thread; keep ≥ 2 entries in it
positions?: number[]; // optional stop positions (0..1, ascending), same
// length as colors; ignored if the lengths differ
// (with animated colors, applied as given)
}
interface AreaDotsConfig { // dot-lattice fill of the area beneath the line
spacing?: number; // lattice pitch (px) between dots, both axes; default 12
size?: number; // dot diameter (px); default 1.6
color?: string; // dot color; omit to derive a faint tint from the line color
opacity?: number; // overall field opacity (0..1); default 1
}
interface ThresholdConfig {
// The split value (Y-axis units). A SharedValue for a single live
// benchmark, OR a LiveChartPoint[] for a time-varying threshold the split,
// band + marker follow point-for-point (clamps to its first/last value outside
// its range → flat-extends to the live edge). See the Threshold split guide.
// Provide value OR series (series wins).
value?: SharedValue | LiveChartPoint[];
// LIVE time-varying threshold: like the LiveChartPoint[] form but a
// SharedValue — .set()/.modify() tracks on the UI thread, no re-render
// (a VWAP updated every tick). Points sorted by time, like `data`.
series?: SharedValue;
aboveColor?: string; // stroke at/above value; default palette up-green
belowColor?: string; // stroke below value; default palette down-red
fill?: boolean | ThresholdFillConfig; // line↔threshold P/L band; default off
includeInRange?: boolean; // fold the threshold into the Y-range fit (like reference lines); default false
extendToStart?: boolean; // series: extend first value flat to the window start; default true
extendToNow?: boolean; // series: extend flat past the last point to "now"; default true
line?: boolean | ThresholdLineConfig; // marker line at value; default off
}
// Object form of `fill`: band opacity (0..1) on the above/below colors; default 0.16.
interface ThresholdFillConfig { opacity?: number }
interface ThresholdLineConfig {
label?: string; // label text, e.g. "Break-even"
labelPosition?: "left" | "right"; // "left" = inside plot (clear of y-axis); default "left"
labelAnchor?: "first" | "last"; // series: visible left-edge or live/right-edge value; default "last"
color?: string; // line + label color; default palette refLine/refLabel
labelColor?: string; // label text color; falls back to color, then palette refLabel
intervals?: [number, number]; // dash pattern; default [4, 4]
strokeWidth?: number; // default 1
showValue?: boolean; // append the formatted value to the label; default false
}
interface ThresholdBadgeRenderProps {
line: ThresholdLineConfig; // resolved marker-line config
value: SharedValue; // live threshold value
valueStr: SharedValue; // formatted with the chart's formatValue
y: SharedValue; // live canvas Y (NaN when geometry is unavailable)
visible: SharedValue; // whether the badge is inside the plot
}
interface BadgeConfig {
variant?: "default" | "minimal";
tail?: boolean; // pointed tail toward the dot; false = pill sits flush
// at the gutter edge (no tail space reserved); default true
background?: string;
position?: "right" | "left";
// Value in the right-gutter pill: centered, or lined up with a right-anchored
// Y-axis label column (yAxis.labelRightMargin) — kept within the pill's padX
// (next to the tail, a narrow pill gives up the left padding, then the
// right), moves with the column's width. Default "center".
textAlign?: "center" | "yAxisColumn";
// Shape / style — all Skia-native, drawn in the batched canvas pass (no perf cost):
radius?: number; // corner radius (px); default capsule (pillHeight/2), clamped to that max
borderColor?: string; // pill border color; default none
borderWidth?: number; // border stroke width (px), only drawn with borderColor; default 1
textColor?: string; // label text color override; default variant/theme rule
fontSize?: number; // badge font size (px); falls back to the chart `font`
fontFamily?: string; // badge font family; falls back to the chart `font`
fontWeight?: FontWeight; // badge font weight; falls back to the chart `font`
offsetX?: number; // nudge the whole badge horizontally (px); default 0
offsetY?: number; // nudge the whole badge vertically (px); default 0
followViewEdge?: boolean; // while time-scrolled, track the price at the visible
// window's right edge (badge value/color + value line + dot);
// buffered/controlled lines stay on the latest recorded
// point while it is in the window, then follow the edge;
// default false
}
interface PulseConfig {
interval?: number; duration?: number; maxRadius?: number;
opacity?: number; strokeWidth?: number;
}
interface ValueLineConfig { strokeWidth?: number; intervals?: [number, number]; color?: string }
// Shared styling for a straight line (the connector, valueLine, …). Omit `intervals` for solid.
interface LineStyleConfig { color?: string; strokeWidth?: number; intervals?: [number, number] }
interface ScrubConfig {
markers?: boolean | ScrubMarkerConfig; // opt-in timestamp matching; default false
tooltip?: boolean; // existing master tooltip switch; false also suppresses seriesTooltip
// LiveChartSeries only: opt-in Morfi-style time + per-series value pills.
// false/omitted preserves the existing guide-only default.
seriesTooltip?: boolean | PerSeriesTooltipConfig;
dimTarget?: "future" | "otherCandles"; // default "future"; otherCandles hides the scrub line/dot in candle mode, falls back to future in line mode
dimOpacity?: number; // opacity of the selected dim target; clamped to [0, 1]; default 0.3
dimFadeMs?: number; // otherCandles fade-in/out duration; default 60; 0 = instant
crosshairLineColor?: string; crosshairDimColor?: string; // crosshairDimColor = legacy colored mask
crosshairStrokeWidth?: number; // line width in px; default 1
crosshairOvershoot?: number; // extend past top/bottom in px; preserves a custom top-tooltip stop; negatives clamp to 0; default 0
crosshairFade?: boolean; // fade near the live edge; default true
crosshairFadeDistance?: number; // visible line/dot/tooltip fade distance in px; negatives clamp to 0; default 4
crosshairLineCap?: "butt" | "round" | "square"; // omit to preserve the existing Skia default
crosshairDash?: number[] | boolean; // dash the crosshair line; true = [4,4], or explicit [on, off, …] px
tooltipBackground?: string; tooltipColor?: string; tooltipBorderColor?: string;
tooltipBorderRadius?: number; // pill corner radius; default 5
tooltipPlacement?: "side" | "top" | "bottom" | "point"; // default "side" (offset/flip); top/bottom center over the line; point floats above the scrub dot
tooltipMargin?: number; // gap (px) to the pinned plot edge (top for side/top, bottom for bottom); default 8
tooltipShowValue?: boolean; tooltipShowTime?: boolean; // default both true; drop a row (e.g. date-only)
panGestureDelay?: number; // press-and-hold ms before scrubbing activates; default 0
clampToPlot?: boolean; // plain scrub: ignore starts beyond the plot's X bounds and clamp active drags; default false
hideOverlaysOnScrub?: boolean; // fade markers + reference lines out while scrubbing; default false
snapToCandles?: boolean; // candle mode: snap the crosshair to candle centers (tick-to-tick); gaps between candles + line mode keep the raw X; default false
}
interface PerSeriesTooltipConfig {
alwaysShow?: boolean; // pin value pills to visible endpoints while idle; default false
bucketSeconds?: number; // omit to infer from the first visible series
formatSeriesValue?: (value: number, seriesId: string) => string; // UI-thread worklet
formatTimeRange?: (from: number, to: number) => string; // UI-thread worklet
maxLabelChars?: number; // ellipsis truncation; default 14
guideColor?: string;
guideWidth?: number; // default 1
guideDashPattern?: boolean | number[]; // default [3,3]; false = solid
timePillBackground?: string; timePillColor?: string; timePillBorderColor?: string;
timePillRadius?: number; timePillPaddingX?: number; timePillPaddingY?: number;
seriesPillBackground?: string;
seriesPillLabelColor?: string;
seriesPillValueColor?: string;
seriesPillBorderColor?: string;
seriesPillRadius?: number;
seriesPillPaddingX?: number; seriesPillPaddingY?: number;
seriesPillDotSize?: number; seriesPillDotGap?: number;
seriesPillLabelValueGap?: number;
intersectionDotSize?: number;
}
// Order-ticket mode (scrubAction). Opt-in — default off.
interface ScrubActionConfig {
icon?: string; // action-badge glyph; default "+"
background?: string; // action-badge background; default the accent / badge color
iconColor?: string; // icon + price-text color; default the badge text color
lineColor?: string; // horizontal level-line color; default palette.crosshairLine
text?: boolean; // show the price readout; default true. false → icon-only pill
timeBadge?: boolean; // date/time pill where the line meets the x-axis; default false
snap?: number; // round the reported price to this increment (e.g. 0.01, 0.5)
dismissOnTapOutside?: boolean; // empty-plot tap dismisses vs. re-places; default false
dismissOnAction?: boolean; // dismiss the reticle once the badge fires onScrubAction; default false
}
interface SelectionDotRingConfig {
color?: string; // ring color, defaults to the dot color
width?: number; // ring thickness past the dot, default 2
}
// The scrub-intersection dot (selectionDot). Default ON for LiveChart,
// OFF for LiveChartSeries (the crosshair + opt-in per-series tooltip dots mark it).
interface SelectionDotConfig {
size?: number; // dot radius, default 4
color?: string; // dot color, defaults to the line / leading-series color
ring?: boolean | SelectionDotRingConfig; // outer halo, default on
component?: ComponentType; // custom Skia dot; ignores size/color/ring
}
interface GridStyleConfig { color?: string; strokeWidth?: number; intervals?: number[]; opacity?: number }
interface YAxisScaleGestureConfig {
minScale?: number; // positive finite; default 0.25
maxScale?: number; // positive finite, at least minScale; default 10
dragDistance?: number; // points per exponential step; default 160
doubleTapReset?: boolean; // animate to clamped 1 over 240ms; default true
}
interface YAxisConfig {
// Chart formatValue(value, tickStep?) receives this grid's source-unit step.
// Fixed count supplies the evenly spaced step; dynamic ticks supply the fine
// interval. Badges/tooltips/layout samples omit it; one-arg formatters work.
// Built-in vertical price-axis drag; writes yRangeScale or internal state.
// Down zooms out, up zooms in. Default false. See the Y-range scaling guide.
scaleGesture?: boolean | YAxisScaleGestureConfig;
// Label side; reserve left label width with insets.left. Default "right".
side?: "left" | "right";
minGap?: number; // min px gap between grid lines; default 36
// Multiplier used to choose dynamic nice intervals without changing plotted
// values. Pair with formatValue using the same multiplier. Must be positive
// and finite; invalid values use 1. Unrepresentable scaled ranges fall back
// to source-unit intervals. Ignored with count. Default 1.
intervalScale?: number;
// Show a fixed number of evenly-spaced prices (top = high, bottom = low)
// instead of the dynamic nice-interval grid. Values track the live range each
// frame. `minGap` still floors the spacing; clamped to at most 15. Default 0.
count?: number;
// Place labels in a shared left-aligned column whose right edge sits this
// many px from the canvas edge. Omit for the centered-gutter placement.
// Line the live badge's value up with it via badge.textAlign "yAxisColumn".
labelRightMargin?: number;
// Gap between the shared label column and each grid/plain-reference-line end.
// Only applies with labelRightMargin. Default 0.
gridEndGap?: number;
// Float the price axis over a full-width plot instead of reserving a right
// gutter — the line/candles run to the edge and the labels float on top.
// Pairs with `timeScroll` (see the Time-scroll guide). Default false. @experimental
float?: boolean;
}
interface XAxisConfig {
// Minimum pixel gap between time labels. Updates immediately, even while paused.
minGap?: number; // default 60
// Vertical grid lines at the time labels, behind the series, each fading with
// its label. true = the gridStyle look; a GridStyleConfig overrides only the
// fields it sets (the rest fall back to gridStyle). Default false.
// Strokes stay within the plot width while departing labels fade into gutters.
gridLines?: boolean | GridStyleConfig;
}
// Fades both axes while LiveChart is idle. @experimental
interface AxisAutoHideConfig {
fadeInMs?: number; // interaction-start fade duration; default 60
fadeOutMs?: number; // fade back to idle; default 250
idleOpacity?: number; // axes' resting opacity (0 = hidden); default 0
hideAfterMs?: number; // idle delay before fade-out; default 3000
}
// Volume bars below the candles (candle mode only). Bars normalize to the largest
// visible volume; the candle plot shrinks by `maxHeight` to make room. @see CandlePoint.volume
interface VolumeConfig {
upColor?: string; // bars for up (close ≥ open) candles; default palette.candleUp
downColor?: string; // bars for down candles; default palette.candleDown
maxHeight?: number; // reserved band height (px) = the tallest bar; default 48
radius?: number; // bar-top corner radius (px); default 2
opacity?: number; // opacity of the whole band (0..1); default 0.6
}
// Horizontal time-scrolling (pan back through history). @experimental
interface TimeScrollConfig {
gesture?: "holdToScrub" | "axisDrag"; // activation; default "holdToScrub"
scrubHoldMs?: number; // holdToScrub: press-hold (ms) before scrub engages; default 500
hideLiveOnScrollBack?: boolean; // hide live badge + dot + value line while scrolled back (they mark the off-screen live price); default true. Ignored with badge.followViewEdge
overscroll?: number; // fraction of the window (0–1) pan/zoom may travel past the data bounds into blank space (TradingView-style); default 0 (hard stops at the oldest data / live edge)
fling?: boolean; // keep release momentum after a fast drag; false stops exactly where the finger lifts. Default true.
}
// Tunes the return-to-live glide (the `returnToLive` prop). @experimental
interface ReturnToLiveConfig {
duration?: number; // glide duration (ms) back to live; default 450 (0 = instant snap)
}
// Tune/disable the built-in transition animations — the object form of `transitions`.
interface TransitionConfig {
reveal?: number; // grow-in when data appears, on timeframe change, or candle→line; default 600 (0 = snap)
mode?: number; // candle↔line crossfade (single-series LiveChart only); default 300 (0 = snap)
candleLerpSpeed?: number; // candle-width ease speed (0–1, like smoothing); candle mode; default 0.08 (1 = instant resize)
}
// Styling for the breathing loading shell — the object form of `loading`.
interface LoadingConfig {
color?: string; // squiggle + skeleton color; default theme gridLine
strokeWidth?: number; // squiggle stroke width; default the chart line strokeWidth
amplitude?: number; // base breathing-wave height (px); default 14
speed?: number; // breathing-wave speed multiplier; default 1 (0 freezes)
axisLabels?: boolean; // draw the skeleton Y-axis placeholders; default true (false = squiggle only)
freezeAfterMs?: number; // freeze the squiggle after this many ms per showing; default none (≤ 0 = frozen at once)
}
// Pinch-to-zoom the visible time window (two-finger, focal-anchored). @experimental
interface ZoomConfig {
minTimeWindow?: number; // tightest window in seconds (max zoom-in); default timeWindow / 8
maxTimeWindow?: number; // explicit widest window; default full data/anchored history span, at least timeWindow
}
// Vertical price panning on the plot (LiveChart, holdToScrub time-scroll). @experimental
interface PriceScrollConfig {
// "afterScale" (default): a vertical drag pans price only once the range was
// manually changed (price-axis drag, pinch, earlier price pan), so an untouched
// chart still lets a parent ScrollView scroll. "always": every vertical drag pans.
activation?: "always" | "afterScale";
maxOvershoot?: number; // travel past the fitted range, in visible spans; default 1 (0 = none)
}
// Floating reset-view button inside the plot (LiveChart). @experimental
interface ResetButtonConfig {
placement?: "bottom-center" | "bottom-right"; // default "bottom-center"
// Which manual states show the button; default all true.
showFor?: { yScale?: boolean; priceScroll?: boolean; timeScroll?: boolean; zoom?: boolean };
margin?: number; // distance from the plot edges (px); default 12
fadeMs?: number; // show/hide fade; default 160
icon?: string; // built-in button: glyph drawn with the chart font; default "↺"
size?: number; // built-in button: diameter (px); default 36
color?: string; // built-in button: fill; default palette.badgeBg
iconColor?: string; // built-in button: glyph color; default palette.badgeText
accessibilityLabel?: string; // built-in button: screen-reader label
}
// Props handed to renderResetButton. The chart owns placement, visibility, fade
// and the tap, so return a plain view rather than a pressable.
interface ResetButtonRenderProps {
visible: SharedValue; // true while the view differs from the fitted live view
reset: () => void; // runs resetView(); wire to iOS onAccessibilityTap / Android activate action
}
// App-owned UI-thread viewport. LiveChart only (line/candle). @experimental
interface ChartViewportControl {
end: SharedValue; // right-edge unix seconds; null = follow live
window: SharedValue; // positive, finite width in seconds; null = timeWindow
range?: SharedValue | null>; // exact price bounds while end is non-null; invalid/null/omitted = auto-fit
}
// The viewport prop accepts false | ViewportConfig; false/omitted uses private state.
// Both shared values are required, so there is no true shorthand.
interface ViewportConfig extends ChartViewportControl {
windowSmoothing?: boolean; // default true; false copies non-null widths immediately
}
// Gestures write this pair; resetZoom() nulls both. Non-null values survive
// timeWindow/timeScroll/overscroll-setting changes. Future end values are honored;
// an end before the first retained point falls back to live unless range is valid.
// range requires finite min/max and difference, with min < max; it applies immediately,
// overriding auto-fit, range easing, nonNegative, maxValue, minRange, and yRangeScale.
// resetZoom never writes range; end=null makes an app-written range inactive.
// With priceScroll, the price pan and axis-scale gestures write range too; such
// a gesture-written range stays active while following live, is clamped to
// nonNegative/maxValue/minRange, and is cleared by resetView(), an axis
// double tap, or a snapKey/mode change.
// A later app write (including modify()) or replacement range SharedValue
// relinquishes gesture ownership; app-written bounds are preserved by resets.
// windowSmoothing affects only non-null widths, not value, automatic Y-range, or reset easing.
// Visible window reported by onVisibleRangeChange (unix seconds). @experimental
interface VisibleRange {
startSec: number; // left-edge time of the visible window
endSec: number; // right-edge time of the visible window
following: boolean; // true when at the live edge (not scrolled back / paused)
}
// Edge label (topLabel / bottomLabel). Default off — both opt-in.
interface AxisLabelConfig {
format?: (v: number) => string; // built-in value formatter; defaults to formatValue
color?: string; // text color; defaults to palette.gridLabel (muted)
// "left"/"right" pin to that edge (default "right"). "extrema" floats the label
// on the actual high (topLabel) / low (bottomLabel) data point. "extrema-edge"
// keeps the label on the top/bottom edge (x-aligned) with a dot + connector.
position?: "left" | "right" | "extrema" | "extrema-edge";
fontSize?: number; // built-in value text size (px); default 11
fontWeight?: FontWeight; // built-in value text weight; default platform default
fontFamily?: string; // built-in value text font family
dotColor?: string; // extrema modes — dot color; defaults to color
dotSize?: number; // extrema modes — dot diameter (px); default 7
dot?: boolean; // extrema modes — draw the marker dot; default true
// "extrema-edge" connector (dot → edge label). true = dashed default, false =
// none, or a LineStyleConfig. Default on (dashed) in "extrema-edge" mode.
connector?: boolean | LineStyleConfig;
render?: () => React.ReactElement | null; // custom element; overrides everything above
}
interface ChartInsets { top?: number; right?: number; bottom?: number; left?: number }
interface LeftEdgeFadeConfig { width?: number; startColor?: string; endColor?: string }
interface DotGlowConfig {
color?: string; // default: resolved dot fill color
radius?: number; // glow source-circle radius, default 7
blur?: number; // Skia blur radius, default 5
opacity?: number; // 0–1, default 0.18
}
interface DotRingConfig {
color?: string; // default: theme `badgeOuterBg`
width?: number; // default 2.5
}
// Shared live-dot styling (LiveChart `dot`; LiveChartSeries `dot` extends it)
interface DotConfig {
radius?: number; // color-filled dot radius, default 3.5
ring?: boolean | DotRingConfig; // crisp outer backing ring, default true
glow?: boolean | DotGlowConfig; // soft static glow, default false
show?: boolean; // @deprecated — prefer dot={false}; default true
color?: string; // dot fill, defaults to the line color
trackWhileParked?: boolean; // while scrolled back / overscrolled, the dot tracks the true live point — keeps pulsing, stays visible, hides once the point leaves the window; ignored with badge.followViewEdge (LiveChart only). Default false
}
interface MultiSeriesDotConfig extends DotConfig {
pulse?: boolean | PulseConfig;
valueLine?: boolean | ValueLineConfig;
valueLabel?: boolean;
}
interface LegendConfig {
visible?: boolean;
compact?: boolean;
position?: "top" | "bottom";
style?: LegendStyle;
}
interface FontConfig {
fontFamily?: string; // default "Menlo"
fontSize?: number; // default 11
fontWeight?: FontWeight;
typeface?: DataSourceParam; // require(...) / path / Uint8Array
fontManager?: SkFontMgr | null;
}
```
## RangeAnimationConfig
Exported config for the shared `rangeAnimation` prop on `LiveChart` and `LiveChartSeries`.
```ts theme={null}
interface RangeAnimationConfig {
animateExpansion?: boolean; // default false; outward bounds snap
expansionSmoothing?: number; // inherits smoothing; only used with animateExpansion
contractionSmoothing?: number; // inherits smoothing
}
```
Speeds are per-60fps-frame fractions of the remaining gap, using frame-rate-independent
exponential easing. Finite overrides clamp to 0..1; non-finite overrides inherit `smoothing`.
While the fitted and displayed ranges do not overlap, contraction is limited to the
animated expansion speed so the bounds cannot cross.
`smoothing: 1`, explicit snaps, static mode, and active manual Y-scale dragging take precedence.
Axis-label fades remain under `metrics.grid`. See
[Y-range animation](/guides/y-range-scale#animating-automatic-range-changes).
## SeriesRangeAnimationConfig
Exported `LiveChartSeries` config extending `RangeAnimationConfig` with a
reversible UI-thread range transform. Its first measured, visible data fits
immediately; direction-specific easing applies to subsequent updates:
```ts theme={null}
interface SeriesRangeAnimationConfig extends RangeAnimationConfig {
transform?: (range: {
min: number; max: number; // untransformed fitted/eased bounds
from: number; to: number; // visible Unix-second interval
}) => { min: number; max: number };
}
```
The worklet may read SharedValues. Its output changes presentation after normal
fit/easing; it never changes recorded values or feeds the next fit. Removing it
restores the untransformed range. Non-finite, equal or inverted bounds are ignored.
Configured hard bounds apply to the underlying fit before transforming. Existing
expansion/contraction speeds, snaps and manual scaling apply to that fit.
## Imperative handle
`LiveChart` and `LiveChartSeries` accept a ref with the same exported handle:
```ts theme={null}
interface LiveChartHandle {
// Reset built-in pinch zoom to timeWindow and clear its focal offset so the
// chart follows the live edge again. Safe when already reset.
resetZoom(): void;
// Return to the fitted live view: resetZoom() plus yRangeScale back to 1 and,
// on LiveChart, a gesture-written price range cleared. The right edge glides
// back with the returnToLive timing. Safe when already fitted. @experimental
resetView(): void;
}
```
Use `useRef(null)` and pass the ref to either chart. A paused chart remains paused.
See [Time-scroll → Reset zoom from a button](/guides/time-scroll#reset-zoom-from-a-button) and
[Reset view](/guides/reset-view).
On `LiveChart` with `viewport`, `resetZoom()` clears the supplied `end` and `window`
shared values. In a sync group, reset the leader and mirror its drawn return.
## AxisLabelConfig
Shape for the `topLabel` / `bottomLabel` props. Both are opt-in (default off).
With `true`, the chart floats its current top (`topLabel`) / bottom
(`bottomLabel`) Y-axis bound at that edge, formatted with `format` (falling back
to the chart's `formatValue`) in `color` (falling back to the muted
`palette.gridLabel`), aligned by `position`. The values track the live Y-axis
range each frame on the UI thread. Set `render` to float a fully custom element
at the edge instead of the built-in value. `position: "extrema"` instead floats
the label (a dot + value, or your `render` element) at the actual data point
where the high / low occurs, tracking it as the chart scrolls. See
[Axis labels](/guides/axes-and-grid#axis-edge-labels) and
[Marking the extrema points](/guides/extrema-labels).
## SelectionDotProps
Props passed to a custom `selectionDot.component` — the dot drawn at the scrub
intersection. Every positional input is a `SharedValue`, so the dot animates on
the UI thread without re-renders.
```ts theme={null}
interface SelectionDotProps {
x: SharedValue; // scrub X in canvas px
y: SharedValue; // scrub Y (line / value intersection)
active: SharedValue; // whether scrubbing is active
opacity: SharedValue; // crosshair fade opacity (0..1), already ramped
color: string; // resolved dot color (line / series accent)
size: number; // suggested dot radius in px
}
```
## ScrubMarkerConfig
`scrub.markers` is available on `LiveChart` and `LiveChartSeries`. `true` uses
the default tolerance; an object configures it:
```ts theme={null}
interface ScrubMarkerConfig {
radius?: number; // line mode: horizontal canvas px on each side; default 16
}
```
Negative radii clamp to `0`; omitted or non-finite radii use `16`. In line mode,
timestamps must be within the drawn time window and the tolerance around the
crosshair. Candle mode ignores the radius and selects the hovered bucket's
`[candle.time, candle.time + candleWidth)` interval. No candle or a declared gap
selects none. Matches retain input order and `data`, regardless of glyph Y,
`side`, stacking, collapsed groups, or `maxVisible`. Matching uses all supplied
markers, including markers associated with a hidden series; filter the input if
those trades should be excluded. No matching work runs while scrubbing is inactive.
## TooltipRenderProps
Context passed to a custom `renderTooltip` — the fully custom scrub tooltip. The element you
return is a React Native view the chart floats over
the canvas and positions on the UI thread (per `scrub.tooltipPlacement`). Every live field is a
`SharedValue`, so bind them to animated text (e.g. an `Animated.createAnimatedComponent(TextInput)`
driven by `useAnimatedProps`) and both movement **and** text stay on the UI thread — no JS
re-render while scrubbing. See [Custom tooltip](/guides/scrubbing#custom-tooltip-rendertooltip).
```ts theme={null}
interface TooltipRenderProps {
markers: SharedValue; // scrub.markers matches; [] when disabled/inactive/no match
value: SharedValue; // value under the crosshair (candle mode: the close)
time: SharedValue; // window time (unix seconds) under the crosshair
valueStr: SharedValue; // value formatted with the chart's formatValue
timeStr: SharedValue; // time formatted with the chart's formatTime
active: SharedValue; // whether scrubbing is active
// Candle mode: the OHLC bucket under the crosshair (null in line mode / inactive).
candle: SharedValue;
// Line or candle mode: the declared gap under the crosshair (null otherwise).
gap: SharedValue;
}
```
## ChartOverlayContext
The price↔pixel / time↔pixel bridge passed to a custom
[`renderOverlay`](/api-reference/livechart#renderoverlay) on `LiveChart` or
`LiveChartSeries`. It hands you a single per-frame `scale` `SharedValue` plus pure
mapping worklets.
```ts theme={null}
interface ChartOverlayContext {
scale: SharedValue; // live scale, recomputed each frame
priceToY: (price: number, scale: ChartScale) => number; // price → canvas Y px (-1 before layout)
yToPrice: (y: number, scale: ChartScale) => number | null; // canvas Y px → price (clamped; null before layout)
timeToX: (time: number, scale: ChartScale) => number; // unix seconds → canvas X px
xToTime: (x: number, scale: ChartScale) => number; // canvas X px → unix seconds
}
interface ChartScale {
min: number; // live Y-axis lower bound (price at the plot bottom)
max: number; // live Y-axis upper bound (price at the plot top)
window: number; // visible time window in seconds
now: number; // right-edge timestamp (unix seconds)
plot: ChartPlotRect;
}
interface ChartPlotRect {
left: number; // padding.left
top: number; // padding.top
right: number; // canvasWidth - padding.right
bottom: number; // canvasHeight - padding.bottom
width: number; // full canvas width
height: number; // full canvas height
}
```
**Easiest path — the `usePriceY` / `useTimeX` hooks.** They project a price / time to
a `SharedValue` that tracks the live axis for you. Render one component per
level and read the value in your `useAnimatedStyle`:
```tsx theme={null}
function PriceLevel({ ctx, price }) {
const y = usePriceY(ctx, price); // reactive — tracks the rescaling axis
const style = useAnimatedStyle(() => ({ transform: [{ translateY: y.get() }] }));
return ;
}
```
**Manual path.** Read `scale.get()` inside your worklet — that read subscribes it to
the live scale — then feed the snapshot to the pure mappings. (Reanimated only
observes SharedValues read directly in a worklet's closure, so the mappings take the
snapshot as an argument rather than reading it themselves.)
```tsx theme={null}
const style = useAnimatedStyle(() => {
const s = scale.get(); // subscribe to the live scale
const y = priceToY(142.5, s); // project a price level to its pixel
return { transform: [{ translateY: y }] };
});
```
## DegenOptions
The most-used fields (see the source for the full tuning surface):
```ts theme={null}
interface DegenOptions {
scale?: number; // default 1
downMomentum?: boolean; // also trigger on down swings; default false
shake?: boolean; // default true
shakeIntensity?: number;
shakeDurationSec?: number; // default 0.45
burstParticleCount?: number; // default 20
particleOpacity?: number; // default 0.55
colors?: string | string[];
// ...plus particle slot/size/speed/jitter tuning
}
```
## Palette
`accentColor` + `theme` derive a full `LiveChartPalette`. Override any subset via the `palette`
prop. Frequently overridden keys:
```ts theme={null}
interface LiveChartPalette {
line: string;
fillTop: string; fillBottom: string;
gridLine: string; gridLabel: string;
dotUp: string; dotDown: string; dotFlat: string;
candleUp: string; candleDown: string; wickUp: string; wickDown: string;
dashLine: string; refLine: string; refLabel: string;
crosshairLine: string; crosshairDim: string;
tooltipBg: string; tooltipText: string; tooltipBorder: string;
// ...glow, badge, and font-size keys
}
```
## Metrics
The geometry/motion analogue of `LiveChartPalette`. Override any subset via the `metrics` prop
(per-namespace shallow merge — only the keys you set are replaced). See the
[Theming guide](/guides/theming#sizing-and-motion-tokens).
```ts theme={null}
interface LiveChartMetrics {
badge: BadgeMetrics;
candle: CandleMetrics;
grid: GridMetrics;
motion: MotionMetrics;
emptyState: EmptyStateMetrics;
}
interface BadgeMetrics {
padX: number; // pill horizontal padding, default 10
padY: number; // pill vertical padding, default 3
tailLength: number; // tail spike toward the dot, default 5
marginEdge: number; // gap from the canvas edge, default 4
dotGap: number; // gap between the dot and the tail tip, default 12
tailSpread: number; // tail curve control-point spread, default 2.5
}
interface CandleMetrics {
minBodyPx: number; // min body height so dojis stay visible, default 1
maxBodyPx: number; // max body width, default 40
bodyWidthRatio: number; // body width as a fraction of the slot, default 0.8
minGapPx: number; // min gap (px) between adjacent bodies; 0 = ratio-only, default 2
bodyRadius: number; // body corner radius (px); 0 = sharp, default 0
wickWidth: number; // wick (high–low line) stroke width (px), default 1
}
interface GridMetrics {
fadeInSpeed: number; // per-frame alpha lerp when a line/label fades in, default 0.18
fadeOutSpeed: number; // per-frame alpha lerp when it fades out, default 0.12
}
interface MotionMetrics {
badgeColorSpeed: number; // badge color transition lerp speed, default 0.08
adaptiveSpeedBoost: number; // extra catch-up over `smoothing` when the value lags, default 0.12
}
interface EmptyStateMetrics {
labelOpacity: number; // empty-state label opacity, default 0.35
gapPad: number; // half-padding around the empty text, default 20
gapFadeWidth: number; // fade width each side of the empty-text gap, default 30
}
// `metrics` prop type — every namespace and field optional:
type LiveChartMetricsOverride = {
badge?: Partial;
candle?: Partial;
grid?: Partial;
motion?: Partial;
emptyState?: Partial;
};
```
## Right-anchored axis layout
`YAxisConfig.labelRightMargin` also selects automatic gutter sizing from the
actual painted tick column in both charts. Padding includes column width, edge
margin, the largest dot/pulse/glow outset and six points of clearance. Initial
samples add half a font-size of headroom until ticks exist. Width changes alone
trigger React layout updates. Explicit right insets and badge requirements
retain priority; centered, left and floating layout behavior is unchanged.
## LiveChartSeries presentation clock
`LiveChartSeriesProps.presentationTime?: SharedValue` drives
current time on the UI thread. Defined Unix seconds take precedence over
`nowOverride`/wall time; `undefined` restores that fallback. Paths and range fits
exclude future samples while a head is supplied; tips and dots stop at the
presentation head or viewport edge, whichever is earlier. The scrub time limit
uses the same clock. See [Replay clock](/guides/multi-series#replay-clock).
## LiveChartSeries history start
`LiveChartSeriesProps.historyStartTime?: number` is an authoritative Unix-second
start for a growing live window. With no pan/zoom override, the displayed width
is `(now - historyStartTime) / (1 - windowBuffer)`. Buffer must be in `[0, 1)`;
invalid/future starts use `timeWindow`. `resetZoom()` resumes the growing view.
Default pinch maximum includes this full span, independent of retained sample
timestamps. Explicit zoom bounds take precedence, including maxima smaller than
`timeWindow`. See [All history](/guides/multi-series#all-history).
# Android surface rendering
Source: https://react-native-livechart.brandtnewlabs.com/guides/android-surface-rendering
Profile the experimental opaque SurfaceView canvas and know when to keep TextureView.
`LiveChart` and `LiveChartSeries` use Skia's transparent canvas mode by default. On Android,
that is backed by a `TextureView`, which composes naturally with content behind the chart.
For an opaque chart, you can profile Skia's `SurfaceView` path:
```tsx theme={null}
```
`canvasMode="opaque"` is experimental and opt-in. The chart paints the resolved palette
background as the first canvas draw, then uses background-color composites for the left-edge
fade, scrub dim, and loading/empty label gap. This preserves those effects without relying on
destination alpha.
## When to keep the default
Keep `canvasMode="transparent"` when the chart must reveal an image, gradient, blur, video, or
other content behind it. It is also the fallback if a consuming layout shows SurfaceView-specific
problems with sibling ordering, clipping, transforms, parent scrolling, gestures, screenshots,
or accessibility overlays.
The mode name describes composition, not the theme: opaque mode supports both light and dark
palettes and responds to palette changes. A custom `style.backgroundColor` does not replace the
canvas-owned background; set `theme` or `palette.bgRgb` so the painted background and surrounding
container agree.
## Profiling
Do not choose SurfaceView from emulator timings. Compare identical release builds on representative
physical Android devices and hold the workload, refresh rate, temperature, and power mode constant.
Capture at least:
* frame-time p90/p99 and missed frames;
* `dumpsys gfxinfo`;
* Perfetto RenderThread and GPU/compositor slices;
* SurfaceFlinger layers;
* visual screenshots while scrubbing and loading.
This repository includes a fixed workload at `app/android-surface-profile.tsx`. Select the backing
view at bundle time with `EXPO_PUBLIC_ANDROID_SURFACE_PROFILE_MODE=transparent` or `opaque`.
## Physical-device result
The controlled harness was captured on a physical Samsung Galaxy S24 (`SM-S921B`) at 120 Hz using
release builds, 10,000 retained points, a 120-second visible window, and 30 incoming updates per
second. Each row is normalized to the active Perfetto animation span so the two trace lengths do not
skew the comparison.
| Metric | Transparent TextureView | Opaque SurfaceView |
| - | -: | -: |
| Animation callbacks per second | 119.75 | 101.35 |
| Animation slice p90 / p99 | 6.51 / 7.77 ms | 10.51 / 12.30 ms |
| Animation slices over the 8.33 ms budget | 0.3% | 99.5% |
| App scheduled CPU | 1,601 ms/s | 1,318 ms/s |
| Main-thread scheduled CPU | 746 ms/s | 981 ms/s |
| Android RenderThread scheduled CPU | 438 ms/s | 0 ms/s |
| SurfaceFlinger scheduled CPU | 471 ms/s | 404 ms/s |
SurfaceView eliminated the Android RenderThread composition pass and reduced total app scheduled CPU
by about 18%, but moved rendering onto the main thread and failed the 120 Hz frame budget. The
transparent run's `dumpsys gfxinfo` window reported p90 / p99 of 10 / 11 ms and no modern frame
deadline misses. Android does not include the separately composed SurfaceView's chart frames in that
counter, so the opaque row uses Perfetto rather than treating its zero-frame `gfxinfo` report as a
performance result.
SurfaceFlinger confirmed a separate, device-composed, opaque layer for SurfaceView. Physical
screenshots also preserved the chart, rounded clipping, and a React Native sibling overlay. The
result supports keeping `"transparent"` as the default and exposing `"opaque"` only as a profiled,
layout-specific opt-in. Repeat the matrix on the consuming app's representative devices before
enabling it broadly.
# Automatic sleep
Source: https://react-native-livechart.brandtnewlabs.com/guides/auto-sleep
Pause a live chart, let its engine sleep, and resume animation.
Open **Demos → Live data & engine → Automatic sleep** in the example app.
The screen receives 12 simulated prices per second and shows the last 15 seconds,
so both the live tip and the scrolling time axis are easy to see.
1. Watch the live chart move.
2. Tap **Pause live feed**. This demo stops the simulated feed and sets `paused`.
Existing easing finishes, then the readout changes to **Asleep** with zero engine ticks.
3. Tap **Resume live feed**. New prices arrive, the window catches up to real time,
and the chart animates again.
4. Pause again and turn **Automatic sleep** off. The picture stays still, but the
original engine loop keeps running. Turn it on to let the engine sleep again.
The chart stays mounted throughout the comparison. The activity readout is sampled
in a separate component so its updates do not re-render the chart. It measures
engine ticks, **not display FPS**. The pulse is disabled because a continuous pulse
intentionally keeps the engine awake.
## Recorded example
The recording shows live updates, pause at about 7 seconds, resume at 16 seconds,
and the sleep switch comparison at 29–36 seconds. Agent-device observed
60 → 0 → 60 engine ticks per second on a dedicated iOS debug simulator. Two
settled chart captures 1.5 seconds apart were pixel-identical. This verifies the
tested interaction; physical-device performance and battery use still need testing.
```tsx theme={null}
const { data, value } = useSimulatedChartData({ paused, tradesPerSecond: 12 });
```
`useSimulatedChartData` is an example-app helper, not a library export. In a real app,
pausing the chart does not automatically stop your data source: continued data
changes wake the engine as needed.
`autoSleep` is experimental, defaults to `false`, and currently applies only to
single-series `LiveChart`. See the [API reference](/api-reference/livechart) and
[Historical data](/guides/historical-data#experimental-automatic-sleep) for its
continuous-effect and static-mode rules.
# Axes & grid
Source: https://react-native-livechart.brandtnewlabs.com/guides/axes-and-grid
Tune the grid lines, hide or space the axes, float edge labels, and adjust the plot insets.
> [!NOTE]
>
> **Live example:**
> [`app/demo/axes-and-grid.tsx`](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/demo/axes-and-grid.tsx)
> in the example app.
Grid lines, axis spacing, and edge labels
## Grid & axes
```tsx theme={null}
```
Pass `yAxis={false}` or `xAxis={false}` to hide an axis. `gridStyle.intervals` of `[]` renders
solid grid lines.
`xAxis.minGap` sets the minimum pixel spacing between time labels (default `60`).
Changing it updates the label set immediately on both chart components, including
paused charts and views parked by scrolling or zooming. Labels can be spaced
farther apart when their text would otherwise overlap.
The right gutter is measured with your `formatValue` and font once a finite,
nonzero live value arrives. A `0` loading placeholder does not lock it to a short
label. It measures again after the value moves by a factor of ten in either
direction from the last sample, keeping ordinary ticks and small changes around
a power of ten from moving the plot's edge. `LiveChartSeries` samples the largest
finite absolute value across its series, including negative values alongside
zero placeholders. An explicit `insets.right` overrides automatic measurement.
## Vertical grid lines
`xAxis.gridLines` adds a vertical line under each time label, so the grid runs in
both directions. The lines draw behind the series, in the same layer as the
horizontal grid, and fade in and out with their labels at the plot edges.
```tsx theme={null}
```
`gridLines: true` styles the lines with `gridStyle`. A `GridStyleConfig` overrides
only the fields it sets; the rest still come from `gridStyle`. The lines follow
the label spacing (`xAxis.minGap`), run down through a candle chart's volume
band to the axis line, and hide with the axis (`xAxis={false}`) and under
`LiveChart`'s `axisAutoHide`. They are off by default, on both `LiveChart` and
`LiveChartSeries`. Strokes are clipped to the plot width, so a fading tick cannot
draw a grid line into the reserved Y-axis gutters.
## Left-side Y-axis labels
Both `LiveChart` and `LiveChartSeries` accept `yAxis.side`; it defaults to `"right"`.
Reserve enough room for your widest formatted label with `insets.left`:
```tsx theme={null}
```
Labels are centered in the left gutter. Its width is explicit rather than measured
automatically, so account for your font and formatter. Grid lines still span the
plot. Right-label options (`float`, `labelRightMargin`, `gridEndGap`) do not position
left labels. The live badge and multi-series value labels remain on their existing
side. Left labels render after the left-edge fade so the gutter stays readable.
## Fixed Y-axis price count
By default the Y axis picks a dynamic number of "nice"-value grid lines from `minGap`. Pass
`yAxis={{ count }}` to instead show a **fixed** number of prices, spaced evenly down the plot —
top label = current high, bottom = current low. The count stays constant as data streams in;
the values track the live range each frame (they aren't rounded to nice numbers).
```tsx theme={null}
```
`minGap` still acts as a floor: if `count` labels won't fit at least `minGap` px apart, the count
drops to what fits. The count is clamped to at most 15.
## Nice intervals in display units
Use `intervalScale` when stored values and displayed values differ by a constant multiplier.
The chart keeps every point in its original units, but chooses dynamic grid intervals after
applying the multiplier. Apply the same multiplier in `formatValue`:
```tsx theme={null}
const DISPLAY_SCALE = 987_654_321;
const formatDisplayValue = (value: number) => {
"worklet";
return `$${Math.round(value * DISPLAY_SCALE)}`;
};
```
This can turn labels such as `$9,876,543` and `$10,864,198` into round `$10,000,000` and
`$11,000,000` intervals. The chart geometry, markers, reference lines, and scrub values stay in
their original units. The multiplier must be positive and finite; invalid values behave as `1`.
If applying it would overflow or underflow the current live range, interval selection safely falls
back to source units. Fixed-count mode ignores it because `{ count }` tracks the exact visible range
instead of choosing nice intervals.
## Minimum Y range
On a short window the data can move less than one display step, so every grid label formats to the
same text. Pass `minRange` (in data units) to keep the fitted span at least that tall; flatter data
widens around its midpoint instead of zooming in:
```tsx theme={null}
```
Data that already spans more than `minRange` fits as before. On a `nonNegative` chart or under
`maxValue`, the span slides off the bound instead of shrinking, including when a bound clips
the ordinary fit's margin. If both hard bounds leave less room than the requested floor,
the available span wins. Use positive finite values; invalid or overflowing floors are ignored.
Manual [`yRangeScale`](/guides/y-range-scale) zoom still applies on top and can go below the floor.
`LiveChartSeries` accepts it too. The [Minimum Y range demo](/guides/minimum-range) compares
rounded labels, both engines, bounds, static re-settling, and manual zoom.
## Right-anchored price label column
Set `labelRightMargin` to place every Y-axis label at the same left X in a column whose right edge
is measured from the canvas edge. Add `gridEndGap` to keep a fixed gap between the grid-line end
and that column:
```tsx theme={null}
{
"worklet";
return `$${value.toFixed(2)}`;
}}
font={{ fontSize: 11 }}
yAxis={{ labelRightMargin: 8, gridEndGap: 6 }}
/>
```
For a right-anchored column, both chart components measure the actual tick
strings on the UI thread. Automatic right padding reserves that width plus the
canvas-edge margin, the largest dot/pulse/glow radius, and six points of
clearance. An initial formatted sample adds half a font-size of precision
headroom until ticks exist. Layout updates on the React thread only when the
measured width changes. Badge and inline series-label requirements can reserve
additional space; explicit `insets.right` takes precedence.
Without `labelRightMargin`, labels keep their default centered-gutter placement and `gridEndGap`
has no effect. When combined with `yAxis.float`, `labelRightMargin` overrides the floating axis's
default edge margin.
Plain horizontal `referenceLines` stop at the same X as the grid, keeping the gap consistent.
`fullWidth` reference lines and value/time bands keep their existing extents.
### Badge value in the column
By default the live badge centers its value in the pill. To line it up with the label column, set
`badge={{ textAlign: "yAxisColumn" }}`: the value starts at the labels' left X, and a value wider
than every axis label ends at the column's right edge. Two trade-offs make this opt-in:
* The pill keeps its shape and the value stays within its `padX` padding, so the room on each side
comes from the right inset and the badge metrics. Next to the tail, whose taper already keeps the
value off the outline, a pill too narrow for both paddings gives up the left one first, then the
right one, so the value moves continuously as the pill narrows. With an inset of `dotGap`, the
tail (`tailLength` plus half the pill's height), the value, `padX` and `marginEdge`, the value ends
`padX` from the pill's end (the column's right edge when `marginEdge + padX` equals
`labelRightMargin`). The value's width is Skia's `measureText` box, which can be wider than the
glyph advances. A value wider than a tailed pill's body, or one that doesn't fit both paddings of
a pill without a tail, is centered.
The automatic right inset reserves room for one more digit, which ends up left of the value. For
even padding, size `insets.right` for your widest price and set `metrics.badge` so
`marginEdge + padX` equals `labelRightMargin`.
* The value moves sideways whenever the column's width changes: a wider label entering or leaving
the axis (`99.95` → `100.00`), or digits of different widths in a proportional font.
```tsx theme={null}
{
"worklet";
return `$${value.toFixed(2)}`;
}}
font={{ fontSize: 11 }}
yAxis={{ labelRightMargin: 8, gridEndGap: 6 }}
badge={{ textAlign: "yAxisColumn" }}
metrics={{ badge: { marginEdge: 4, padX: 4 } }}
insets={{
right: 84, // fits "$100.00" with this 11 px font and these badge metrics
}}
/>
```
It applies to the default right-gutter badge with the column on the right. With
`yAxis.side: "left"`, while the axis floats (`yAxis.float`; with `timeScroll`, only while scrolled
back), and with `badge={{ position: "left" }}`, the value stays centered. `badge.offsetX` moves the
value with the pill. To place a pill relative to the column yourself, turn the badge off and anchor
your own pill to the column in `renderOverlay`, as the
[Phantom showcase](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/showcase/phantom-up-down.tsx)
does for its target pill.
For an interactive comparison of centered and column-aligned values, including
the transition across \$100 and padding/font fallbacks, open the
[Badge alignment demo](/guides/badge-alignment).
## Axis edge labels
`topLabel` and `bottomLabel` float a value at the top / bottom edge of the plot — the
Robinhood-style high/low readout. Pass `true` for the batteries-included label: the chart shows
its current top (`topLabel`) and bottom (`bottomLabel`) Y-axis bound, formatted with the chart's
`formatValue` and updated each frame on the UI thread.
```tsx theme={null}
```
Both default off. Pass an [`AxisLabelConfig`](/api-reference/types#axislabelconfig) to tune the
built-in label — `format`, `color`, `position` (`"left"` | `"right"`, default `"right"`), and the
text `fontSize` / `fontWeight` / `fontFamily`:
```tsx theme={null}
`$${v.toFixed(2)}` }}
/>
```
For full control, the `render` escape hatch floats any element at the edge (it overrides the
built-in value):
```tsx theme={null}
High }}
/>
```
> [!NOTE]
>
> To pin the label to the **actual high / low data point** instead of the edge — `position: "extrema"`
> / `"extrema-edge"` — see [Extrema labels](/guides/extrema-labels).
## Spacing
Adjust the drawing area with `insets` (`top`, `right`, `bottom`, `left`) and soften the left edge
with `leftEdgeFade`.
```tsx theme={null}
```
# Axis auto-hide
Source: https://react-native-livechart.brandtnewlabs.com/guides/axis-auto-hide
Keep a LiveChart minimal at rest while preserving axes during interaction.
> [!NOTE]
>
> **Live example:**
> [`app/demo/axis-auto-hide.tsx`](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/demo/axis-auto-hide.tsx)
> in the example app.
`axisAutoHide` keeps the chart uncluttered at rest: its X and Y axes — grid,
ticks, and labels — are faded to an idle opacity. They fade back in when a user
scrubs, time-scrolls, flings, or pinch-zooms, then return to their idle opacity
after interaction has settled.
```tsx theme={null}
```
The feature is opt-in and experimental. It currently applies to `LiveChart`,
not `LiveChartSeries`; it has no effect on an axis already disabled with
`xAxis={false}` or `yAxis={false}`.
## Configure the idle state
Pass an `AxisAutoHideConfig` to tune the transition. All durations are in
milliseconds. These are the defaults used by `axisAutoHide`:
```tsx theme={null}
```
* `fadeInMs` — duration to reveal the axes when interaction begins.
* `fadeOutMs` — duration to return to the idle state.
* `idleOpacity` — resting opacity from `0` (hidden) to `1` (fully visible).
* `hideAfterMs` — delay after interaction settles before the fade-out begins.
The axes continue to calculate their latest values while hidden, so the labels
are current the instant they reappear. Toggle the feature at runtime if needed:
passing `false` immediately restores fully visible axes; enabling it starts at
the configured idle opacity.
## Time scroll and zoom
Time-scroll momentum and pinch zoom count as interaction even after no finger
is held down. Pair the feature with these optional gestures for a compact
brokerage-style chart that exposes its scale exactly when a user needs it:
```tsx theme={null}
```
# Badge alignment
Source: https://react-native-livechart.brandtnewlabs.com/guides/badge-alignment
Align the live price with the Y-axis label column and compare the centered fallback.
> [!NOTE]
>
> **Live example:**
> [`app/demo/badge-alignment.tsx`](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/demo/badge-alignment.tsx)
> in the example app under **Styling & theming → Badge alignment**.
Centered and column-aligned prices, digit-width transitions, and layout fallbacks
The demo compares the default centered badge with `textAlign: "yAxisColumn"`.
Choose **$99.95**, **$100.00**, or **Repeat transition** to inspect the column as
its widest label gains or loses a digit. The time window is fixed so the same
prices and controls give a repeatable comparison.
```tsx theme={null}
function formatPrice(value: number) {
"worklet";
return `$${value.toFixed(2)}`;
}
```
The value starts at the labels' shared left edge; a value wider than the column
ends at its right edge. The pill keeps its shape. Padding can limit the
alignment: with the tail, a pill too narrow for both paddings gives up the left
one first, then the right one; a value wider than the pill, or one that doesn't
fit both paddings of a tail-less pill, stays centered. The right inset above
fits this demo's 11 px font and prices near \$100; size it for your own widest
price.
Try **Roomy** to make the difference between centering and column alignment more
visible. In **Layout checks**, **Tight** demonstrates the padding limit while
keeping the whole value readable. Gutter presets grow with **Larger font**;
the wider badge value ends at the column's right edge, while the axis column
is still measured with the chart font. **Floating**,
**Left**, **Default** (no column), and **Left of dot** keep the centered behavior.
**Tail** changes the available pill width and whether the value may give up its
paddings, and **Offset −12** moves the whole badge, including its value.
For the complete positioning rules, see
[Axes & grid → Badge value in the column](/guides/axes-and-grid#badge-value-in-the-column)
and [`BadgeConfig`](/api-reference/types#badgeconfig).
# Badge styling
Source: https://react-native-livechart.brandtnewlabs.com/guides/badge-styling
Reshape the live-edge value pill — radius, colors, border, font, and offset.
> [!NOTE]
>
> **Live example:**
> [`app/demo/badge-styling.tsx`](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/demo/badge-styling.tsx)
> in the example app.
Reshaping the live-edge value pill
The value badge at the live edge is drawn in Skia, so its shape and style are
**config knobs on `badge`** rather than a custom React element — they cost
nothing per frame. Pass a `BadgeConfig` to reshape it:
```tsx theme={null}
```
`radius` is clamped to the capsule (`pillHeight / 2`), which stays the maximum;
`0` gives sharp corners. `textColor` mirrors `background` (set either or both).
The font knobs fall back to the chart [`font`](/guides/theming#fonts) when omitted.
`tail: false` removes the pointed spike toward the live dot **and** the space
reserved for it: the pill body sits flush at the gutter edge, right after the
dot gap, and the auto right padding shrinks to match. (The tail only applies to
the default `position: "right"` badge.)
> [!NOTE]
>
> A badge `fontSize` larger than the chart font can crowd the reserved right
> gutter (the badge text and y-axis labels share that space and are aligned to
> the chart font). If a bigger badge font overflows, pair it with
> `badge={{ position: "left" }}` or `yAxis={{ float: true }}`, which don't use
> the gutter.
`textAlign: "yAxisColumn"` lines the value up with a right-anchored Y-axis label column
(`yAxis.labelRightMargin`) instead of centering it in the pill; see
[Axes & grid → Badge value in the column](/guides/axes-and-grid#badge-value-in-the-column) for
the trade-offs and a matching `metrics.badge` / `insets.right` setup.
# Candle feedback
Source: https://react-native-livechart.brandtnewlabs.com/guides/candle-feedback
Per-candle scrub callbacks, entry snapshots, and haptic feedback.
> [!NOTE]
>
> **Live example:**
> [`app/demo/candle-feedback.tsx`](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/demo/candle-feedback.tsx)
> in the example app under **Interaction → Candle feedback**.
Candle entries, gap exits, a stationary forming-candle hold, and idle callbacks
Use `onScrubCandleChange` for feedback that should happen on candle entry rather
than every live update. It runs on the **JS thread**, so it can update React
state or call a haptics API directly. The callback receives an OHLC snapshot at
entry; updates inside that bucket do not fire it again. Revisiting the candle
after another candle or a gap fires a new entry event.
```tsx theme={null}
import * as Haptics from "expo-haptics";
import { useState } from "react";
import { LiveChart, type CandlePoint } from "react-native-livechart";
const [selected, setSelected] = useState(null);
{
setSelected(candle);
if (candle) void Haptics.selectionAsync();
}}
/>
```
The callback sends `null` when a selection ends, moves into a gap, or leaves
candle mode. After that, line mode stays quiet. Omitting the callback disables
its JS notifications. `snapToCandles` is optional; the callback is keyed by the
selected candle's bucket time in both snapped and continuous scrubbing.
The demo includes a two-bucket gap and a forming candle updated on the UI
thread. Its fixed clock keeps the same buckets under a stationary pointer,
making the callback counts repeatable:
* Drag across candles: **Candle entries** increases at each new bucket.
* Move into the shaded gap: **Exits / gaps** increases once with `null`.
* Revisit a candle: a fresh entry appears in the event log.
* Drag from **Drag** to **Hold**, then keep your finger on the forming candle:
**Forming candle updates** keeps increasing, while the entry count stays
fixed within that bucket.
* Enable **Compare onScrub**: the optional per-frame callback counter grows
while the forming candle changes. It is off by default so the normal example
only sends candle entry and exit notifications to JS.
**Options** also exposes line/candle mode, snapping, the gap, pausing the feed,
haptics, and callback omission. Haptics cannot be felt in an iOS simulator;
review their entry timing using the counter and log.
For continuously updated OHLC, read `ctx.candle` in
[`renderTooltip`](/guides/scrubbing#custom-tooltip-rendertooltip) on the UI thread,
or use `onScrub`. The per-candle callback is for selection changes and snapshots.
# Candlestick
Source: https://react-native-livechart.brandtnewlabs.com/guides/candlestick
Render OHLC candlestick bars with a live in-progress candle.
Set `mode="candle"` and supply committed OHLC bars plus an optional in-progress candle. Both
must be `SharedValue`s so the chart can read them on the UI thread.
> [!NOTE]
>
> **Live example:**
> [`app/demo/candlestick.tsx`](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/demo/candlestick.tsx)
> in the example app.
Candlestick mode with a live, forming candle
```tsx theme={null}
import { useSharedValue } from "react-native-reanimated";
import { LiveChart, type CandlePoint } from "react-native-livechart";
const candles = useSharedValue([]);
const liveCandle = useSharedValue(null);
;
```
## The candle shape
Each bar is an OHLC bucket:
```ts theme={null}
interface CandlePoint {
time: number; // bucket start, unix seconds
open: number;
high: number;
low: number;
close: number;
volume?: number; // optional — drives the volume bars (see below)
}
```
* **`candles`** — committed bars, sorted by `time`.
* **`liveCandle`** — the in-progress bucket, updated each tick. Set it to `null` between buckets.
* **`candleWidth`** — bucket size in seconds; drives bar width and spacing.
> [!NOTE]
>
> `data` / `value` are still used for the line/candle morph and momentum detection, so keep
> feeding them alongside your candles.
## Coloring
Bullish/bearish body and wick colors come from the palette derived from `accentColor` + `theme`.
Override them precisely via the [`palette`](/guides/theming) prop (`candleUp`, `candleDown`,
`wickUp`, `wickDown`).
## Body size, spacing & wick shape
Candlestick geometry lives in the `metrics.candle`
[sizing tokens](/api-reference/types#metrics). Body width is the smallest of
`bodyWidthRatio × slot width`, `slot width - minGapPx`, and `maxBodyPx`, with a 1px floor.
`minGapPx` defaults to `2`, preserving a visible gap between adjacent bodies. On dense charts,
set it to `0` to let `bodyWidthRatio` keep bodies proportional instead of collapsing them to the
1px floor:
```tsx theme={null}
```
The 1px body floor takes precedence when a slot is too narrow to preserve the configured gap.
Volume bars automatically use the same body width and spacing. `bodyRadius` defaults to `0`
(sharp corners), and `wickWidth` defaults to `1`. See
[`CandleMetrics`](/api-reference/types#metrics) for every sizing token and default.
## Volume bars
Pass `volume` to draw volume bars in a reserved band **below** the candles. The candle/price plot
shrinks by the band height to make room (candles are never cut off) and the x-axis stays pinned to
the bottom. Each bar reads its candle's `volume`; bar heights are normalized to the **largest
visible volume**, so the tallest visible bar fills the band. Candles without a `volume` draw no bar.
```tsx theme={null}
const candles = useSharedValue([
{ time: 1700000000, open: 48, high: 52, low: 47, close: 50, volume: 1200 },
// …
]);
;
```
Configure colors, band height, rounding, and opacity with a
[`VolumeConfig`](/api-reference/types#config-objects):
```tsx theme={null}
;
```
> [!NOTE]
>
> Volume is **candle mode only**. Bars align under the candle bodies (same width + center), colored
> by candle direction (up/down) unless you override `upColor` / `downColor`.
## Historical reference series
Overlay a changing average cost, VWAP, peg, or other historical benchmark with the
[`referenceLines.series`](/guides/reference-lines-and-bands#time-varying-reference-line-series)
form. It draws a Skia polyline over the candles using the same time and Y scales, supports the
normal reference-line color, dash, width, and label fields, and extends its last value flat to
the live edge by default.
```tsx theme={null}
```
## Scrubbing & the OHLC tooltip
Pass `scrub` to enable the crosshair: the built-in tooltip shows the scrubbed candle's O/H/L/C
stacked with its time. For full control — a minimal pill, your own layout, or to mirror the active
candle elsewhere in your UI — pass [`renderTooltip`](/guides/scrubbing#custom-tooltip-in-candle-mode),
which receives the scrubbed bucket as `ctx.candle`. The JS-thread [`onScrub`](/guides/scrubbing)
callback also includes `point.candle` for the OHLC under the crosshair. Set
[`scrub.snapToCandles`](/guides/scrubbing#snap-to-candle-centers-snaptocandles) to make the
crosshair jump from candle center to candle center instead of gliding.
See the full prop list in the [`LiveChart` reference](/api-reference/livechart).
For intervals without OHLC—no trades, exchange maintenance, or incomplete feed
coverage—use [`candleGaps`](/guides/empty-candles) instead of fabricating normal
bullish/bearish candles.
## Candle path construction
Sharp candle bodies reuse a plain rectangle input within each body-path rebuild.
This avoids creating a Skia rectangle wrapper for every candle. The chart still
uses four batched paths for up/down bodies and wicks, and returns fresh immutable
paths so live updates repaint normally. Rounded bodies and volume bars retain
their existing drawing behavior. No configuration change is required.
Volume bars use the same rectangle reuse for sharp bars. The largest visible
historical volume is recalculated when candle data notifies a change or the
visible bucket bounds change. Live volume is included on every geometry update.
Use normal SharedValue updates or `.modify()` for in-place edits; array length is
not used as a data revision.
# Chart gaps
Source: https://react-native-livechart.brandtnewlabs.com/guides/empty-candles
Represent no-trade, unavailable, and unknown line or candle intervals without fabricating market data.
Sparse timestamps are ambiguous: the market may have been open with no trades, trading may have
been unavailable, or the data feed may be incomplete. `lineGaps` and `candleGaps` attach that
meaning explicitly without inserting synthetic samples or OHLC records.
> [!NOTE]
>
> **Live example:**
> [`app/demo/empty-candles.tsx`](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/demo/empty-candles.tsx)
> switches between moving line and candlestick charts while a simulated trade
> feed continues. Compare raw sparse data, forward-fill, semantic-default, and
> custom-styled treatments. The **Styled** treatment exposes section toggles,
> independent colors, bridge paint, band fill/border/dashes, and label
> placement. Use **Live trades** to pause the feed for inspection.
```tsx theme={null}
import { LiveChart, type ChartGap } from "react-native-livechart";
const gaps: ChartGap[] = [
{
from: maintenanceStart,
to: maintenanceEnd,
kind: "unavailable",
label: "Exchange maintenance",
},
];
;
```
The same metadata works in candlestick mode:
```tsx theme={null}
```
## Semantic states
| Kind | Default price treatment | Default market-state treatment |
| - | - | - |
| `"no-trades"` | Flat bridge at the previous observed value/close | No time band |
| `"unavailable"` | Flat previous-value/close bridge | Shaded time band with an optional label |
| `"unknown"` | No forward-filled price | Shaded time band with an optional label |
The library never infers a reason from sparse timestamps. With no gap prop, a line retains its
normal interpolation across missing timestamps and a candle chart retains its normal empty space.
Real samples or candles take precedence when they conflict with a declared range.
## Styling
Both props accept the same `ChartGapsConfig` object. Override one or more semantic styles:
```tsx theme={null}
```
Each nested section can be set to `false` to disable it, omitted to keep that gap kind's semantic
default, or set to an object to enable it and override its paint. For example,
`{ bridge: {}, band: false, label: false }` gives a forward-fill-only treatment. This preserves
time spacing but is intentionally ambiguous; prefer a labeled `"unavailable"` band when downtime
is known. A gap with no preceding real observation cannot be price-bridged.
## Renderer behavior
Line mode splits the main stroke, gradient/area fill, dot-lattice fill, and threshold fill into
separate subpaths at every declared empty interval. This prevents the normal spline or straight
segment from implying trades through an outage. A bridge is drawn independently on top, so its
color, opacity, width, and cap do not change the normal line style.
Candle mode emits zero-height previous-close marks for fully covered, actually missing buckets.
Those generated marks carry no volume and do not affect momentum, axis range, or extrema labels.
## Timeframes and partial buckets
Gap ranges use absolute `[from, to)` Unix-second intervals. Candle marks are re-bucketed from
`candleWidth`, so the same metadata works across timeframe changes. Only fully covered, actually
missing buckets receive a mark. A partial outage within a bucket can still show a time band, but it
does not turn a bucket containing trades into an empty candle.
Line gaps are not bucketed: their boundaries map directly to time on the x-axis. A real line point
inside the range makes that gap inert so the library never hides observed data.
## Scrubbing
The built-in tooltip shows a gap's custom `label` (or its semantic default) and time. A bridged gap
also anchors the selection dot and numeric scrub value at the last observation; an unbridged gap
remains price-free. In candle mode, `scrub.snapToCandles` also snaps across explicit `"no-trades"`
buckets.
Custom tooltips receive `ctx.gap: SharedValue`. The JS-thread `onScrub` payload
includes `gap` when the gap supplies a previous value. Unbridged gaps—including `"unknown"` by
default—do not emit a fabricated numeric scrub value.
See [Candlestick](/guides/candlestick) for OHLC input, volume, sizing, and normal candle styling.
# Extrema labels
Source: https://react-native-livechart.brandtnewlabs.com/guides/extrema-labels
Pin the high / low readout to the actual data point where it occurs, not just the edge.
> [!NOTE]
>
> **Live example:**
> [`app/demo/extrema-labels.tsx`](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/demo/extrema-labels.tsx)
> in the example app.
High / low labels pinned to the data points where they occur
[`topLabel` / `bottomLabel`](/guides/axes-and-grid#axis-edge-labels) normally pin the high / low
readout to the plot edge. A `position` variant moves them onto the data instead.
`position: "extrema"` floats the label at the **actual data point** where the value occurs instead
of pinning it to an edge — `topLabel` tracks the highest point, `bottomLabel` the lowest. The chart
projects the extremum's `(time, value)` to a canvas pixel each frame and positions a small dot +
the value there on the UI thread, so it tracks the point as the chart scrolls and the Y-axis
rescales. It's the easiest way to show **when** the high / low happened, not just what it was.
```tsx theme={null}
```
The label hides itself while the loading shell is active, when the window holds no data, or when
the extremum scrolls off the plot (the engine re-picks the visible high / low every frame). When
the high and low resolve to the same point, as they do for a flat series, the chart shows one
label instead of drawing the same extremum twice. It works in **candle mode** too — the extrema
track the highest high / lowest low.
**`"extrema-edge"`** is a variant that keeps the readout on a clean rail: the value label pins to the
top / bottom **edge** (still horizontally aligned with the extremum), and a dot marks the actual
point, joined by a **connector** line. Good when a point-anchored label would crowd the live dot or
sit awkwardly mid-candle.
```tsx theme={null}
```
The connector defaults on (dashed) in `"extrema-edge"` mode; pass `connector: false` to drop it
(value at the edge + dot on the point, no line), or a [`LineStyleConfig`](/api-reference/types#config-objects)
to style it. `dot: false` removes the dot.
Style the built-in label without dropping to a custom render — `fontSize`, `fontWeight`,
`fontFamily` size the value text, and `dotColor`, `dotSize`, and `dot: false` control the marker:
```tsx theme={null}
```
(`fontSize` / `fontWeight` / `fontFamily` style the edge `"left"` / `"right"` labels too; the
`dot*` knobs are `"extrema"`-only.) For anything beyond that, a custom `render` is centered over the
point instead of the built-in dot + value — you own the chrome:
```tsx theme={null}
}}
/>
```
The same props work on [`LiveChartSeries`](/api-reference/livechart-series#axis-labels), where the
bounds track the combined range of the visible series (and `"extrema"` marks the global high / low
across them). The labels are display-only (`pointerEvents="none"`), so they never block scrubbing.
# Historical data
Source: https://react-native-livechart.brandtnewlabs.com/guides/historical-data
Render a fixed historical span edge-to-edge instead of a live-scrolling tail.
> [!NOTE]
>
> **Live example:**
> [`app/demo/historical-data.tsx`](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/demo/historical-data.tsx)
> in the example app.
A fixed historical span rendered edge-to-edge
To render a fixed historical span edge-to-edge — rather than a live-scrolling tail — freeze the
engine's clock with `nowOverride` and reserve a little right-edge space with `windowBuffer`:
* **`nowOverride`** — override the engine's "now" (unix seconds). Set it to your dataset's last
timestamp so the window ends exactly there.
* **`windowBuffer`** — right-edge padding as a fraction of `timeWindow`, so the latest point
isn't flush against the edge.
```tsx theme={null}
```
See the full prop list in the [`LiveChart` reference](/api-reference/livechart), and the live
[Playback](/guides/playback) controls for tuning the window, smoothing, and Y-axis range.
## Experimental automatic sleep
Use `autoSleep` to keep an interactive historical chart asleep when its engine has
settled. Unlike setting `static`, this preserves easing and wakes automatically:
```tsx theme={null}
```
The engine waits for 160 ms of unchanged state before it stops requesting frames.
Data (including `SharedValue.modify`), chart size, range inputs, theme, pan, pinch,
and scrub activation wake it. Paused wall-clock charts and charts parked in history
can sleep too. Live scrolling remains active. Existing Reanimated animations can
finish independently of the engine.
This prototype is **off by default** and applies to `LiveChart` line and candle
modes, not `LiveChartSeries`. A configured pulse keeps it awake, so use `pulse={false}`
when a still historical chart is intended. Loading/empty charts and enabled degen
or trade-stream effects conservatively remain awake. `static` takes priority, and
`isFrameLoopActive={false}` still gates work until re-enabled.
The example app's `/idle-profile` route provides a deterministic 6,000-point chart
with an A/B toggle and an engine-tick readout. That readout is **not screen FPS**.
The local prototype report at `docs/auto-sleep-prototype.html` includes agent-device
CPU samples and videos. Simulator debug measurements do not establish device
battery savings or production frame health.
## Reusing history calculations
`LiveChart` reuses the lowest and highest history values while the data revision
and visible index bounds stay the same. Small viewport movements and value/range
animation can reuse this work. Crossing a data boundary or editing history triggers
a new scan. Line and candle history have separate revisions.
This is automatic and adds no prop. The live candle, animated value, reference
lines, threshold range and gap anchors are still evaluated each tick, so changing
them does not require rescanning history. `LiveChartSeries` is unchanged.
Publish data changes through the SharedValue: replace the array with `.set(...)`,
or use `.modify(...)` for an in-place edit. The cache follows notifications, not
array length or endpoint values. Do not mutate a nested value silently without
notifying the SharedValue; consumers cannot reliably observe that change.
```tsx theme={null}
data.modify((points) => {
"worklet";
points[index].value = correctedPrice;
return points;
});
```
Static charts also refresh their fitted range for notified interior edits, even
when the array length and first/last points are unchanged.
# Line & area
Source: https://react-native-livechart.brandtnewlabs.com/guides/line-and-area
Customize the single-series line chart: gradient, badge, value line, dot, and live value.
`LiveChart` renders a single line series by default. History comes from a
`SharedValue` and the live tip from a `SharedValue`.
> [!NOTE]
>
> **Live example:**
> [`app/demo/line-and-area.tsx`](https://github.com/brandtnewlabs/react-native-livechart/blob/main/app/demo/line-and-area.tsx)
> in the example app.
Line & area
```tsx theme={null}
```
## Line styling
Override the stroke with the `line` prop, and the area fill with `gradient`:
```tsx theme={null}
```
Pass `gradient={false}` to remove the area fill entirely.
### Animating the line and fill color
`line.color` also accepts a `SharedValue`, and `gradient.colors` a
`SharedValue`. The chart hands them to Skia as they are, so the stroke
and the area fill change color on the UI thread with no re-render. Drive both
from one progress value to keep them in step:
```tsx theme={null}
const progress = useSharedValue(0);
const color = useDerivedValue(() =>
interpolateColor(progress.get(), [0, 1], ["#a1a1aa", "#22c55e"]),
);
const fill = useDerivedValue(() => [
interpolateColor(progress.get(), [0, 1], ["rgba(161, 161, 170, 0.35)", "rgba(34, 197, 94, 0.35)"]),
interpolateColor(progress.get(), [0, 1], ["rgba(161, 161, 170, 0)", "rgba(34, 197, 94, 0)"]),
]);
<>