> ## Documentation Index
> Fetch the complete documentation index at: https://react-native-livechart.brandtnewlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.
</Note>

<Frame caption="A fixed historical span rendered edge-to-edge">
  <video autoPlay loop muted playsInline controls poster="/media/historical-data.jpg" src="https://mintcdn.com/brandtnewlabs/3aK_iydbC8Ff9g3s/media/historical-data.mp4?fit=max&auto=format&n=3aK_iydbC8Ff9g3s&q=85&s=3489e415a7e47a9c84ef067d55c80c78" data-path="media/historical-data.mp4" />
</Frame>

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}
<LiveChart
  data={history}
  value={lastValue}
  timeWindow={span}
  nowOverride={lastTime}
  windowBuffer={0.04}
  paused
/>
```

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}
<LiveChart
  data={history}
  value={lastValue}
  timeWindow={span}
  nowOverride={lastTime}
  autoSleep
  pulse={false}
/>
```

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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.