我对交互式 chloropeth 图的大部分计算都是通过各种附加小部件的回调完成的。
我们可以在情节启动时运行回调吗?这可以通过构造一个刷新/初始化按钮并为其附加一个启动回调来实现,但这仍然需要按下一个按钮。
DocumentReady
事件,可用于此。来自 JavaScript:
from bokeh.events import DocumentReady
curdoc().js_on_event(DocumentReady, CustomJS(...))
或来自 Python(在 Bokeh 服务器应用程序中):
curdoc().on_event(events.DocumentReady, callback)