Published
Edited
Apr 23, 2020
1 fork
Insert cell
Insert cell
vl_spec = ({
"data": {
"name": "SOURCE",
"values": {
"nested": [
{"key": "alpha", "foo": [1, 2], "bar": ["A", "B"]},
{"key": "beta", "foo": [3, 4, 5], "bar": ["C", "D"]}
]
},
"format": {"property": "nested"}
},
"transform": [{"flatten": ["foo", "bar"]}],
"mark": "circle",
"encoding": {
"x": {"field": "foo", "type": "quantitative"},
"y": {"field": "bar", "type": "nominal"},
"color": {"field": "key", "type": "nominal"}
}
})
Insert cell
viewof view = embed(vl_spec)
Insert cell
view.data('SOURCE')
Insert cell
// Apply this function and the data object IS emptied
//view.remove('SOURCE', view.data('SOURCE')).run()
Insert cell
// Apply this function and the data object IS emptied
//view.change('SOURCE', embed.vega.changeset().insert([]).remove(view.data('SOURCE'))).run()
Insert cell
// Apply this function and the data object IS emptied
//view.remove('SOURCE', function() { return true; }).run();
Insert cell
md`## Appendix`
Insert cell
embed = require("vega-embed@6")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more