VegaLiteWriter

Vega-Lite v6 JSON output writer.

Usage

Source

VegaLiteWriter()

Methods

Name Description
render() Render a Spec to a Vega-Lite JSON string.
render_chart() Render a Spec to an Altair chart object.

render()

Render a Spec to a Vega-Lite JSON string.

Usage

Source

render(spec)

render_chart()

Render a Spec to an Altair chart object.

Usage

Source

render_chart(spec, *, validate=False, height=None, width=None, **kwargs)
Parameters
spec: Spec

The resolved visualization specification from reader.execute().

validate: bool = False

Whether to validate the spec against the Vega-Lite schema.

height: int | None = None

Chart height in pixels. When None (the default), the height produced by ggsql is used as-is.

width: int | None = None

Chart width in pixels. When None (the default), the width produced by ggsql is used as-is.

**kwargs: Any
Additional keyword arguments passed to altair.Chart.from_json().
Returns
AltairChart
An Altair chart object (Chart, LayerChart, FacetChart, etc.).