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.

Key fields
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.

FieldTypeDefaultAllowed valuesDescription
query.dimensionsfield mappingGroups query results and supplies category, hierarchy, matrix, graph, or geographic labels.
query.limitintegerno limitpositive integerCaps the number of rows returned to the renderer.
query.measuresmeasure mappingSelects the governed semantic measures consumed by the visual shape.
query.sortsort listOrders query results by a returned field or measure alias.
custom.enginestringvega_liteSelects the constrained custom visualization engine.
custom.programVega-Lite objectDefines 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.