In this case, I have used the changeset insert()
method with new tuples, and the remove() method with the existing tuple; it does not work as I expect. However, in another case, I used remove()
with the vega.truthy
function; it does work.
xxxxxxxxxx
<html>
<head>
<!-- uploaded using vegawidget -->
<script src="https://cdn.jsdelivr.net/npm/vega@4"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@3.0.0-rc10"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@3"></script>
</head>
<body>
<div id="vis"></div>
<script type="text/javascript">
const spec = "spec.json";
const opt = {"defaultStyle":true,"renderer":"canvas"};
vegaEmbed('#vis', spec, opt).then(result => {
// access view as result.view
let changeset = vega.changeset()
.insert([{a: "b", b: 2}, {a: "c", b: 3}])
.remove([{a: "a", b: 1}]);
result.view.change("source", changeset).run();
}).catch(console.error);
</script>
</body>
</html>
https://cdn.jsdelivr.net/npm/vega@4
https://cdn.jsdelivr.net/npm/vega-lite@3.0.0-rc10
https://cdn.jsdelivr.net/npm/vega-embed@3