【发布时间】:2019-07-23 18:55:23
【问题描述】:
我有一个交互式散景图,它使用 CheckBoxGroup 来绘制不同的组合。我希望每次更改组合时都能够修改标题,而不是必须在代码中更改标题并再次生成图。
我对 CustomJS 非常熟悉,但我尝试了以下方法(...仅标题摘录):
p = figure(title = 'Default title that appears',
toolbar_location = 'right')
.
.
update_title = CustomJS(args =dict(source=source, text = text),
code ="""
const data = source.data;
var text = text.value;
text = text.value;
source.change.emit();
""")
text_group = TextInput(title = 'Title', value = "Default value", callback = update_title)
show(column(p,checkbox_group, text_group))
我得到的结果显示了一个标题框,但是当我更改标题时没有任何反应。
I essentially want to do this:
但是使用 CustomJS 而不是 Python 回调。
【问题讨论】:
标签: python-3.x plot callback bokeh interactive