Skip to main content

Layout

Layouts control how the chart is arranged and which panels are open.

The external adapter can store layouts so users can return to the same setup later.

What Gets Saved

The layout data includes things like:

  • layout type
  • panel arrangement
  • active panel
  • symbol
  • timeframe
  • template data
  • indicators
  • drawings
  • compare symbols
  • price scale and time scale settings
  • timezone and interaction state

How It Works

When the chart saves a layout, it can call methods such as:

  • saveLayout(layoutData)
  • loadLayout(layoutId)
  • renameLayout(layoutId, newName)
  • removeLayout(layoutId)
  • autosaveLayout(layoutId, layoutData)
  • getLayouts()

The chart can also:

  • keep a local cached copy of the last active layout
  • restore the most recent chart on startup when load_last_chart is enabled
  • autosave updates while the user works
  • fall back to local cache if the external store is unavailable

Why It Matters

This lets users:

  • save a working setup
  • restore a previous session
  • move between devices or environments without losing the chart state

Local Cache Support

If local caching is enabled, the chart can keep a copy of the most recent layout so it can recover faster on the next load.

The cache layer is useful when:

  • the backend is temporarily unavailable
  • the app wants an offline-friendly restore path
  • you want the chart to reopen with the last active layout automatically