🏠 back to Observable

requiring vega-lite 3


#1

I tried to use the recipe prescribed by Tom McWright’s Module require debugger to require version 3 of vega-lite (currently rc2) but was unsuccessful. This is my fix which involves patching the globalLeaksPattern cell to return the object it was able to retrieve.

Am I missing something? Is there a more streamlined way to do this? Thanks


#2

Hi there,

Took a quick look, and I’m relatively certain it’s a bug in the new Vega pre-releases. I wrote a PR that should fix the bug in the next release, if the Vega team accepts it. https://github.com/vega/vega-lite/pull/4124


#3

Goodie. Thanks!


#4

Related, here are a few ways to load Vega-Lite in Observable:


#5

Thanks. I had already figured some of this by fiddling with vega-lite in observable. It’s just that vegalite v2 does not have a few things that I wanted, like being able to set the font sizes. I’ve adapted the code for vega_explicit in my notebook

The only difference is that it uses vega v4 and vegalite v3 and returns the chart itself rather than a promise.

Incidentally, the current pre-release of vegalite v3 (rc3) now can be required using the global leaks pattern, but it still fails for a ‘normal’ require.


#6

I tried out just the normal require pattern, and it looks like it works just fine: https://beta.observablehq.com/d/16ca53fecd8b852e


#7

You’re right! I was hasty and didn’t wait long enough for the require promise to complete. Sorry for that!
Thanks and regards.