Bokeh 库是否有 JavaScript API?

Does the Bokeh library have a JavaScript API?

它有所谓的 JS 客户端。但所有文档或演示都是从 Python 开发人员的角度编写的。

bokeh 是否有独立的、非 python JavaScript API,是否有人在非 python 环境中使用它?

Does bokeh has standalone, non-python JavaScript API

截至 2019 年底:有点!(有关更多信息,请参见下文)

and is it used by anyone in non-python environments?

是的,当然,尽管与 Python APIs 相比,纯 BokehJS 的使用水平仍然很低。改进 JS 故事是 2020 年的目标。


一点历史

Bokeh 项目于 2012 年启动,其明确目标是为 Python 开发人员提供一种在网络上发布交互式可视化效果的方法,而无需他们自己进入 "web tech",即 JavaScript.因此,BokehJS 库(一直存在)最初主要是一个很大程度上未记录的实现细节。 Bokeh 开发人员本身当时不是 JS 专家,这并没有真正帮助。 (我们中的一些人仍然不是!)

随着事情的进展,以及添加了 CustomJS 回调和自定义扩展功能等功能,BokehJS 方面的内容变得越来越公开。也就是说,直到最近,BokehJS 的开发一直非常快速和激烈,我们无法提供围绕核心 API 稳定性的保证或在可能很快过时的文档上花费资源。举两个例子,去年 BokehJS 完全重写 在 TypeScript 中,这使得任何旧的 CoffeeScript 扩展或回调都被弃用。此外,对整个布局系统进行了重新设计,以提供更高的性能。

当前状态

一段时间以来,BokehJS 有一个相当稳定的 "high level" API,您可以在 Developing with JavaScript chapter of the users guide. Additionally, all the low level "models" and their properties are 100% aligned up between Python and JS, so the Python Reference Guide 中找到它的详细信息,实际上包含您可能需要的所有信息在 JS 端也使用模型。

我们非常有兴趣在来年改进 BokehJS 以供纯 JS 使用。我们得到了 some very helpful issues from folks actually using BokehJS directly. Some major hurdles will be overcome with the upcoming 2.0 release, but there will still be work to do to really provide a great user-experience for JS devs. This is actually a fantastic opportunity for any interested JS devs to have a big impact by offering their input, advice, and collaboration. Anyone so interested should head over to the Bokeh project Discourse.