【发布时间】:2020-05-03 17:12:00
【问题描述】:
我的短脚本如下所示:
output_server('ts_sample.html')
count = 0
def update_title(attrname, old, new):
global count
count = count + 1
textInput = TextInput(title="query_parameters", name='fcp_chp_id', value='fcp_chp_id')
textInput.on_change('value', update_title)
curdoc().add_root(textInput)
p = figure( width=800, height=650,title="ts_sample",x_axis_label='datetime' )
p.line(np.array(data['date_trunc'].values, dtype=np.datetime64), data['latitude'], legend="test")
p.xaxis[0].formatter=bkmodels.formatters.DatetimeTickFormatter(formats=dict(hours=["%F %T"]))
show(curdoc())
当 bokeh server(bokeh serve) 正在运行并且我得到了绘图时,它可以工作,但是 on_change 回调没有按预期工作。
假设 textInput 的值应该是输入框中的内容/字符串,但我多次更改但从未调用回调函数 update_title(count 全局变量始终为 0)。所以显然底层的 textInput.value 没有改变,我怎样才能改变 value attr 并触发 on_change 函数?
【问题讨论】:
标签: bokeh