在使用带条形图的bokeh tap工具时,我需要获取所选条形图的id。如果不使用customJS,如何获取每个条形图的id 代码正在使用bokeh服务器运行
source = ColumnDataSource(data=df)
p = figure(x_range=source.data['month'], plot_height=600, toolbar_location=None, tools="tap,hover", title="month analysis")
p.vbar(x='month', top='count', width=0.5, source=source, legend="month",
line_color='white', fill_color=factor_cmap('month', palette=Spectral6, factors=df['month']))
hover = HoverTool(tooltips=[("count", "@count")])
p.legend.orientation = "horizontal"
p.legend.location = "top_right"
taptool = p.select(type=TapTool)
curdoc().add_root(row( p, width=800))
这应该行得通。可以在source.selected.index中找到选定图示符的ID
相关问题 更多 >
编程相关推荐