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.
Last active
December 13, 2018 23:34
-
-
Save ijlyttle/9224ae0bede3a1478164cd388bddac2e to your computer and use it in GitHub Desktop.
vega-view changeset does not work as expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit | |
height: 500 | |
scrolling: yes | |
border: yes | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v2.json", | |
"datasets": { | |
"source": [ | |
{ | |
"a": "a", | |
"b": 1 | |
} | |
] | |
}, | |
"data": { | |
"name": "source" | |
}, | |
"mark": "bar", | |
"encoding": { | |
"x": { | |
"field": "a", | |
"type": "ordinal" | |
}, | |
"y": { | |
"field": "b", | |
"type": "quantitative" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment