Releases: vega/vega-lite-api
v6.0.0
What's Changed
- docs: Update link to Observable v5 page by @mhkeller in #439
- Add starter code examples by @john-guerra in #144
- feat!: update dependencies, switch to ESM by @domoritz in #462
New Contributors
- @mhkeller made their first contribution in #439
- @john-guerra made their first contribution in #144
Full Changelog: v5.6.0...v6.0.0
v5.6.0
v5.0.0
Updates the Vega-Lite API for Vega-Lite version 5. VL v5 revises the previous selection abstraction into a more general parameters abstraction, supporting both dynamic variables and interactive selections.
Version 5 of the API is mostly, but not entirely, backwards compatible with version 4 of the API. In particular, the selection empty method now takes a boolean rather than a string, and should be applied to a predicate reference to a selection, not a selection definition.
Changelog
Changes from v4.0.0:
- Breaking:
emptyselection method takes a boolean and applies only to selection predicate references, not selection definitions. - Deprecated:
vl.selectSingleandvl.selectMultimethods, now usevl.selectPointinstead. - Deprecated:
mark.selectmethod, now usemark.paramsinstead. - Deprecated:
selection.initmethod, now usevalueinstead. - Add
vl.parammethod to define or reference variable parameters. - Add
vl.exprmethod to refer to Vega expression language statements. - Add
vl.configPointandvl.configIntervalmethods to define selection configurations. Typically one should usevl.selectPointandvl.selectIntervaldirectly. The config options can be used to provide reusable configurations viamark.config({ selection: { point: vl.configPoint() } }). - Add
vl.lookupSelectionmethod to specifylookuptransform parameters against an interactive selection. - Add
vl.specto take a (potentially partial) top-level specification as input. - Add
vl.renderto directly render a specification using thespecoption argument. - Update test cases.
Examples
Here is a scatter plot with dynamic query widgets written using v4 selections...
const cylYear = vl.selectSingle('CylYr')
.fields('Cylinders', 'Year')
.init({ Cylinders: 4, Year: 1977 })
.bind({ Cylinders: vl.slider(3, 8, 1), Year: vl.slider(1970, 1980, 1) });
return vl.markCircle()
.data('data/cars.json')
.transform(vl.calculate('year(datum.Year)').as('Year'))
.select(cylYear)
.encode(
vl.x().fieldQ('Horsepower'),
vl.y().fieldQ('Miles_per_Gallon'),
vl.color().if(cylYear, vl.color().fieldN('Origin')).value('grey')
);...and here is the updated version using v5 parameters.
const cylYear = vl.selectPoint('CylYr')
.fields('Cylinders', 'Year')
.value({ Cylinders: 4, Year: 1977 })
.bind({ Cylinders: vl.slider(3, 8, 1), Year: vl.slider(1970, 1980, 1) });
return vl.markCircle()
.data('data/cars.json')
.transform(vl.calculate('year(datum.Year)').as('Year'))
.params(cylYear)
.encode(
vl.x().fieldQ('Horsepower'),
vl.y().fieldQ('Miles_per_Gallon'),
vl.color().if(cylYear, vl.color().fieldN('Origin')).value('grey')
);v4.0.0
Vega-Lite API v4.0.0 tracks Vega-Lite v4. For examples and documentation, see https://vega.github.io/vega-lite-api/. From this release forward, the major version of Vega-Lite API will track the major version of Vega-Lite. Minor and patch releases will increment separately.