vega-lite-api icon indicating copy to clipboard operation
vega-lite-api copied to clipboard

Add standard HTML example

Open curran opened this issue 6 years ago • 1 comments

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!

curran avatar Aug 24 '19 12:08 curran

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.

curran avatar Aug 30 '19 08:08 curran