-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Altair demo from medium article broken #381
Comments
Hi there, it seems there is a bug in the latest release of Vega. Until that is resolved, you'll need to update this cell: import anywidget
import traitlets
class ChartWidget(anywidget.AnyWidget):
_esm = """
-- import embed from "https://cdn.jsdelivr.net/npm/vega-embed@6/+esm";
++ import embed from "https://esm.sh/vega-embed@[email protected]";
export async function render({ model, el }) {
let spec = JSON.parse(model.get("spec"));
let api = await embed(el, spec);
api.view.addSignalListener(spec.params[0].name, (_, update) => {
console.log(update);
model.set("selection", update);
model.save_changes();
});
}
"""
spec = traitlets.Unicode().tag(sync=True)
selection = traitlets.Dict().tag(sync=True) To be clear, this is a bug in one of the JavaScript dependencies in the blog post (Vega) not anywidget. The other examples in our documentation should still work! Thanks for reporting, and hopefully it gets resolved soon. |
Hi, Thanks very much for the quick response, the example is working for me now! Cheers, Avery |
Hi,
I tried the altair demo: https://blog.jupyter.org/anywidget-jupyter-widgets-made-easy-164eb2eae102
Including the colab demo: https://colab.research.google.com/gist/manzt/2b83d3461c40ac7b43fde29515cb8077/extending_altair_with_anywidget.ipynb#scrollTo=73484882-7670-4711-91ef-3a4c09945ae6
But the cell here fails/the control is not interactive:
The altair widget in the first interactive cell seems to work, so I'm not sure what's happening with the anywidget version.
I tried it on a local install and it failed there too. Note in both colab and my local install the counter demo works fine.
Looks like a very useful library, thanks!
The text was updated successfully, but these errors were encountered: