Live example:
app/demo/historical-data.tsx
in the example app.A fixed historical span rendered edge-to-edge
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 oftimeWindow, so the latest point isn’t flush against the edge.
LiveChart reference, and the live
Playback controls for tuning the window, smoothing, and Y-axis range.
Experimental automatic sleep
UseautoSleep to keep an interactive historical chart asleep when its engine has
settled. Unlike setting static, this preserves easing and wakes automatically:
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.