vega / vega-lite-api

A JavaScript API for Vega-Lite.
https://observablehq.com/@vega/vega-lite-api
BSD 3-Clause "New" or "Revised" License
211 stars 17 forks source link

Replicate examples from Vega-Lite site #438

Open mhkeller opened 1 year ago

mhkeller commented 1 year ago

Thanks for this library. It would be great as a quick reference to have the examples in the Vega-Lite gallery shown using this API.

It's a big lift, though, so one way to make it easy for folks to contribute would be to create a project scaffold with the output specs of each of those existing vega-lite examples. That way, people could fill in the JS api and the repo could run a test to validate the output against the spec. I'd be happy to help set that up if you're interested.

mhkeller commented 1 year ago

If anyone is interested in contributing, I've made this repo as a starting point: https://github.com/mhkeller/vega-lite-api-examples/

domoritz commented 1 year ago

This is great. Note that a lot of examples are already on observable so make sure to check those out.

It might also me interesting to do this translation automatically.

mhkeller commented 1 year ago

As a test run, I asked ChatGPT to do the bar_aggregate example and it got most of the way there but needed some fixing – not sure how well it would do with the more complex example. I see there is this old project but it would probably be out of scope for me to figure that out at the moment. Let me know what you think might be the most productive way forward and how I can help.

curran commented 1 year ago

FWIW there are some older vanilla JS examples here:

https://vizhub.com/curran/717a939bb09b4b3297b62c20d42ea6a3?edit=files&file=viz.js

https://vizhub.com/search?query=vega

mhkeller commented 1 year ago

Update: I reworked that repo so it's easier to contribute – all of the tests are automated based on which src files export something and the readme will automatically keep a running tally of the ones that are remaining.

I set up the example files so that if you’re using GitHub Copilot, it has a prompt to work off of (sometimes it works, sometimes it just generates the last example you wrote). Any ideas for improvement welcome!