Shareable Views (Perspectives)

Premium feature

Shareable Views (Perspectives) 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/perspectives' to enable it.

Perspectives serialize the exact view of a chart, its zoom window, hidden series, selection, annotations, and theme, into a compact token. You can drop that token in a URL and restore the identical view anywhere, which makes charts shareable and bookmarkable.

Enable the feature

import ApexCharts from 'apexcharts'
import 'apexcharts/features/perspectives'

Choose what gets serialized with chart.perspectives.serializeOptions in the chart config.

Capture, share, restore

const token = chart.perspectives.capture()   // a plain, serializable object
const url = chart.perspectives.toURL()        // current href with #apex=<token>
chart.perspectives.apply(token, { animate: true })

capture() returns the view; encode() / decode() convert between the object and a string; toURL() gives you a shareable link.

Named views

Save and list views by name for a "saved views" menu:

const id = chart.perspectives.save('Q3 zoom')
chart.perspectives.list()  // [{ id, name, token }]
chart.perspectives.delete(id)

Restore from a URL

Statics on the class read a view out of a link, so a page can restore the shared state on load:

const token = ApexCharts.perspectives.fromURL(location.href)
if (token) chart.perspectives.apply(token)

When to use Perspectives

Use Perspectives when a specific view is worth sharing or returning to: a dashboard link that opens on the same zoom and hidden-series set, a "copy link to this view" button, or restoring the last view on reload. For scroll-driven storytelling built on the same view tokens, see Storyboard. Try the Shareable views demo.

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