I am using vega charts in my django project. Until now I have used the vegaEmbed to show chart's on web page but now I would like to switch to vega view and I can't found anywhere how to enable actions when using vega view.
This is my code with vegaEmbed:
`<script>
var {{ c.ident }} = {{ c.jSon|safe }}
var {{ c.ident }}_opt = {
actions: true
}
vegaEmbed('#{{ c.ident }}', {{ c.ident }}, {{ c.ident }}_opt);
vegaEmbed('#{{ c.ident }}', {{ c.ident }});
</script>`
And this code with vega view:
`<script>
var vegaJson = {{ jSon|safe }};
var view = new vega.View(vega.parse(vegaJson))
.renderer('svg')
.initialize('#chartDiv')
.hover()
.run();
window.onresize = function (event) {
view.signal('width', event.target.innerWidth - 200)
.signal('height', event.target.innerHeight - 450)
.run('enter');
}
</script>`
Any idea how to enable actions when using vega view?
The actions menu is not defined by the vega view API, it is defined within vega-embed.
Here is how vega-embed creates the actions menu.
If you want to avoid using Vega-Embed and you still want an actions menu similar to what Vega-Embed implements, you would have to write similar code in your vega view script.