Bokeh:在 plot init 上运行回调?

问题描述 投票:0回答:1

我对交互式 chloropeth 图的大部分计算都是通过各种附加小部件的回调完成的。

我们可以在情节启动时运行回调吗?这可以通过构造一个刷新/初始化按钮并为其附加一个启动回调来实现,但这仍然需要按下一个按钮。

python bokeh
1个回答
2
投票

Bokeh 版本 3.1 添加了一个

DocumentReady
事件,可用于此。来自 JavaScript:

from bokeh.events import DocumentReady

curdoc().js_on_event(DocumentReady, CustomJS(...))

或来自 Python(在 Bokeh 服务器应用程序中):

curdoc().on_event(events.DocumentReady, callback)
© www.soinside.com 2019 - 2024. All rights reserved.