我开始使用 Altair,目前我只是想复制这里所做的:https://altair-viz.github.io/gallery/filled_step_chart.html .
我刚刚尝试在我的 Mac(操作系统 10.14.6)上使用 python 3.6(也尝试使用 python3.8)在 Mozilla Firefox 74.0.1(64 位)的 Jupyter 中运行该代码,我收到此错误输出:
Javascript error adding output!
TypeError: document.currentScript is null
See your browser Javascript console for more details.
这是我看到的,还检查了控制台的错误:
我已尝试按照 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')
最佳答案
这看起来像是 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
关于javascript - Altair:Javascript 错误阻止图表显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61211549/