Custom Vega-Lite
Use a custom visualization when the built-in visual types cannot express the analytical view. Custom programs run in a sandbox and receive only the compiled in-memory dataset.
[!EXPERIMENTAL] Custom Vega-Lite is experimental. Its authoring contract, sandbox capabilities, and rendering behavior may change before it is promoted to stable. Prefer a built-in visual type whenever it can express the analytical view.
Every preview on this page is generated from the YAML shown below it using a fixed documentation dataset.
Basic
Reference primary as the named dataset and use query aliases in encodings. LeapView rejects network data, inline values, transforms, parameters, and executable expressions.
visuals:
custom_monthly_revenue:
title: Monthly revenue
description: A constrained Vega-Lite bar chart over governed query data.
type: custom
query:
dimensions:
purchase_month: orders.purchase_month
measures:
revenue: null
sort:
- field: purchase_month
direction: asc
limit: 30
custom:
engine: vega_lite
program:
data:
name: primary
mark: bar
encoding:
x:
field: purchase_month
type: ordinal
y:
field: revenue
type: quantitative
API reference
Kind: chart. Renderer: vega-lite-sandbox. Supported result shapes: custom.
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
query.dimensions | field mapping | — | — | Groups query results and supplies category, hierarchy, matrix, graph, or geographic labels. |
query.limit | integer | no limit | positive integer | Caps the number of rows returned to the renderer. |
query.measures | measure mapping | — | — | Selects the governed semantic measures consumed by the visual shape. |
query.sort | sort list | — | — | Orders query results by a returned field or measure alias. |
custom.engine | string | — | vega_lite | Selects the constrained custom visualization engine. |
custom.program | Vega-Lite object | — | — | Defines a validated declarative program over the in-memory primary dataset; network data, transforms, expressions, and inline values are prohibited. |
Accessibility. Use a descriptive title and unit, and do not rely on color alone to distinguish series or values.