Altair:Javascript错误阻止了图表显示

时间:2020-04-14 15:35:39

标签: javascript python-3.x firefox altair

我开始使用Altair,此刻我正试图复制此处所做的操作:https://altair-viz.github.io/gallery/filled_step_chart.html

我刚尝试在Mozilla Firefox 74.0.1(64位)中的Jupyter中使用python 3.6(也尝试过python3.8)在Mac(OS 10.14.6)上运行该代码,并且出现以下错误:输出:

添加输出时出现Javascript错误!

TypeError:document.currentScript为空

有关详细信息,请参见浏览器Javascript控制台。

这是我所看到的,还检查了控制台的错误:

code and error in Jupyter

我已尝试按照Altair页面上的说明进行射击,https://altair-viz.github.io/user_guide/troubleshooting.html#chart-does-not-display-at-all,但我需要更多指导。

谢谢您的帮助。


更新2020年4月15日:

尝试@jakevdp的解决方法(https://altair-viz.github.io/user_guide/display_frontends.html#displaying-in-the-jupyter-notebook)后,添加该行

alt.renderers.enable('notebook')

我再也没有在Jupyter和控制台中看到该错误,但是该图不显示: no output despite no errors

1 个答案:

答案 0 :(得分:1)

这看起来像Altair的HTML渲染器中的错误;请在http://github.com/altair-viz/altair/issues报告。

作为一种解决方法,您应该能够使用vega nbextension,如此处所述:https://altair-viz.github.io/user_guide/display_frontends.html#displaying-in-the-jupyter-notebook