Undo / Redo (Rewind)

Premium feature

Undo / Redo (Rewind) is a Premium feature

Available on the Premium and OEM plans. It ships in the ApexCharts package as an opt-in import; add import 'apexcharts/features/history' to enable it.

Rewind adds generic undo and redo (Ctrl-Z) over a command journal. Zooms, series toggles, option changes, and annotation edits are all recorded, and high-frequency gestures coalesce into a single step so one continuous drag is one undo, not fifty.

Enable the feature

Rewind is double opt-in: import the feature and set chart.history.enabled: true.

import ApexCharts from 'apexcharts'
import 'apexcharts/features/history'

const options = {
  chart: {
    history: { enabled: true, maxDepth: 100, coalesceMs: 250 },
  },
}

See the chart.history options for every field. With keyboard: true (the default), Ctrl-Z / Ctrl-Y (and Cmd on macOS) work while the chart has focus.

Drive it from code

chart.history.undo()
chart.history.redo()
chart.history.canUndo() // boolean, e.g. to enable a toolbar button
chart.history.canRedo()
chart.history.jump(id)  // jump to a specific journal entry
chart.history.clear()
chart.history.entries() // the recorded steps

Group edits into one step

Wrap several changes in a transaction so they undo together, with an optional label:

await chart.history.transaction(() => {
  chart.hideSeries('Revenue')
  chart.zoomX(1609459200000, 1640995200000)
}, { label: 'Focus Q4 revenue' })

When to use Rewind

Enable Rewind on editing-heavy charts: dashboards where users toggle series and zoom a lot, or annotation authoring where mistakes should be reversible. It pairs naturally with Ink, so every drag, restyle, and delete is undoable, and with the context menu. For a read-only chart, leave it off to keep the bundle lean. Try the Undo / Redo demo.

Rewind ships as a tree-shakeable entry point; see the tree-shaking guide.