Examples completed: 220 / 703
A repository containing Vega-Lite-API implementations of all of the examples in the Vega-Lite gallery.
Contributions welcome!
Test that all of the chart modules in src/
return their matching JSON spec defined in specs/
.
npm test
See the bar_aggregate.vl.js
file as an example.
If you want to write an implementation, go to a file in the src/
folder and create a default function that exports a vega-lite spec. To test it, run npm test
.
Tests are automatically generated when you run npm test
. See the list below for which examples have already been created.
mark
field may not match the spec. This may occur when mark
is nested inside a spec
or a layer
spec
"spec": {
"mark": "bar"
}
vega-lite example output
"spec": {
"mark": { "type": "bar" }
}
To address this issue, the test template recursively finds mark
fields that are strings and converts them into objects.
function convertMarkValues (obj) {
for (const key in obj) {
if (typeof obj[key] === 'object') {
convertMarkValues(obj[key]);
}
if (key === 'mark' && typeof obj[key] === 'string') {
obj.mark = { type: obj[key] };
}
}
return obj;
}
arc_pie_pyramid
file, the ordinal type
field is added but was not present in the spec: "order": {
"field": "order",
"type": "ordinal"
}