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

# Custom charts

> Extend Lightdash beyond the built-in chart types with the chart library, Chart Studio, and Vega-Lite

Custom charts are what you reach for when the built-in chart types don't cover the visualization you need. Every custom chart renders from the same query as any other Lightdash chart, so it respects the same permissions, filters, and dashboard interactions.

There are two ways to bring a custom chart type into your project:

* **[Chart library](https://docs.lightdash.com/visualizations/chart-library.md)** — a catalog of ready-made chart types built by Lightdash. Install one and it appears in the chart type gallery for everyone in the project.
* **[Chart Studio](https://docs.lightdash.com/visualizations/chart-studio.md)** — an agentic in-platform interface for building your own reusable chart types. Describe the chart you want, Lightdash builds it, and anyone in the project can use it like a built-in chart type.

Chart Studio is the preferred way to build custom charts, and the chart library the quickest way to start from a ready-made one. [Vega-Lite](#vega-lite-charts) is still available as a backup for one-off specs, but it's being phased out in favor of custom chart types.

Building custom chart types needs Chart Studio. See the availability note on [Chart Studio](https://docs.lightdash.com/visualizations/chart-studio.md) for where it's available.

## Picking a chart type

Run a query, then open **Configure** in the Explorer and click **Change** to open the chart type gallery. Installed custom chart types appear in the **Custom** group at the top, alongside any chart types your team built in Chart Studio. Pick one, then map its inputs to your query's fields in the **General** tab.

Saved charts remember which chart type they use and which version of it. Updating a chart type in the library or in Chart Studio never changes existing saved charts — see [Versions and upgrades](https://docs.lightdash.com/visualizations/chart-studio.md#versions-and-upgrades) for how to move a saved chart to a newer version.

## Custom charts and data apps

Custom chart types run in the same isolated sandbox that powers [data apps](https://docs.lightdash.com/data-apps), and they round-trip through the CLI as their own [as-code resource](https://docs.lightdash.com/visualizations/chart-studio.md#chart-types-as-code). They are not data apps, though — the two solve different jobs:

* A **data app** is a full interactive application: its own layout, its own queries, and any interactions the agent builds into it. It lives in a space like a dashboard.
* A **custom chart type** is a chart renderer. It has no query of its own — the Explorer runs the query, and the chart type turns those results into a visualization. It shows up in the chart type gallery, not as its own object.

Because they share the runtime, both need the [app runtime](https://docs.lightdash.com/self-host/enterprise-features/data-apps.md) configured on self-hosted instances, and both can reach outside services through [external connections](https://docs.lightdash.com/data-apps/external-connections.md). Data apps also need to be turned on; custom chart types don't.

## Vega-Lite charts

Vega-Lite is a backup option for one-off charts. For anything new, build a custom chart type in [Chart Studio](https://docs.lightdash.com/visualizations/chart-studio.md) instead: it's reusable across the project and keeps dashboard interactions that Vega-Lite charts lose (see [Known limitations](#known-limitations)). To use Vega-Lite, write the chart as a [Vega-Lite](https://vega.github.io/vega-lite/examples) spec in the JSON editor. The spec belongs to that saved chart alone and isn't reusable elsewhere. Open **Configure** in the Explorer, click **Change**, and pick **Vega (JSON editor)** from the **Built in** group in the chart type picker.

![Vega type within the chart type menu](https://mintcdn.com/lightdash/LkTN2-0zVfw2LXpr/images/visualizations/custom-charts/vega-menu.png?fit=max\&auto=format\&n=LkTN2-0zVfw2LXpr\&q=85\&s=4a30064e5d329bf3e9aa3699fd56e9f3)

![The Vega chart type JSON Editor with agent assistance](https://mintcdn.com/lightdash/LkTN2-0zVfw2LXpr/images/visualizations/custom-charts/vega-editor.png?fit=max\&auto=format\&n=LkTN2-0zVfw2LXpr\&q=85\&s=7fd46543fd559a9f71de8d4aeea1d842)

Like custom charts, Vega-Lite unlocks options the built-ins don't cover — heatmaps, bubble plots, box plots, trellis charts, and more. Load a template from the editor to start from a working spec, or copy one from the [Vega-Lite examples gallery](https://vega.github.io/vega-lite/examples). LLMs are good at editing Vega-Lite specs when you want to iterate on one.

> [!NOTE]
>
> Lightdash sizes a Vega-Lite chart to its tile: it replaces the spec's top-level `width` and `height` with the tile's measured size, and sets `autosize` to `fit` by default. Scales follow the tile, but marks placed at literal pixel values such as `"x2": {"value": 260}` don't, so they can be cut off when the tile renders at a different size. Position those marks against the `width` and `height` signals instead, for example `"x2": {"expr": "width"}` or `"x": {"expr": "width - 14"}`.

### Migrating Vega-Lite charts to custom chart types

The fastest way to bring a chart you've configured in Vega-Lite into the newer custom chart type system is to share the Vega-Lite JSON spec and a screenshot with the agent in Chart Studio. The agent can then create a fully interactive custom chart type which you can shift any existing charts to.

### Known limitations

Vega charts trade dashboard interactivity for spec flexibility:

* **Drill-down** — drilling into a metric by grouping it with a dimension isn't available.
* **View underlying data** — clicking a data point to see the underlying records isn't supported.
* **Cross-filtering** — selecting elements in a Vega chart doesn't filter other tiles on the dashboard.

If you need those interactions, use a built-in chart type or a custom chart type from the [chart library](https://docs.lightdash.com/visualizations/chart-library.md) or [Chart Studio](https://docs.lightdash.com/visualizations/chart-studio.md).


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