vega-lite-api
vega-lite-api copied to clipboard
Add standard HTML example
Closes #22
I'm not sure if this should live inside this repo. Feel free to close if this is not warranted.
In figuring this out, I discovered that vega-lite-api and vega-lite browser builds output the same global variable, namely vl. This is unfortunate. To work around this conflict, I did the following in this Standard HTML example:
<script src="https://unpkg.com/[email protected]/build/vega-lite.min.js"></script>
<script>
const vegalite = vl;
</script>
<script src="https://unpkg.com/[email protected]/build/vega-lite-api.min.js"></script>
I would suggest to change the build configuration of vega-lite-api such that it outputs a different global, such as vlAPI or something. Any thoughts on this? Thanks!
Cleaned this up to reflect Vega-lite update with renamed global.
Requesting review please @jheer @domoritz . Thanks!
P. S. One doubt I have is whether or not the following is a recommended practice:
...
.render()
.then(element => document.body.appendChild(element));
It may be cleaner to set up a <canvas> with an ID and render into that, rather than append it like this.