python散景列数据源选择小部件

时间:2018-11-01 18:23:53

标签: python-3.6 bokeh

我试图在Bokeh中绘制交互式图表,并选择列标签以选择要绘制图表的值

enter image description here

df4
col = df4['SL_Name'].tolist()

source = ColumnDataSource(df4)
plot = figure(x_range=col,x_axis_label="Service Line",y_axis_label="Volume", plot_height=300, plot_width=400)
r = plot.vbar(x='col',top='source.data',source=source, bottom=0,width =0.5)


select_state = Select(title="Option:", value="All", options= df4.columns.tolist())

def update_plot(attrname, old, new):
    source.data = ColumnDataSource(df4.select_state.value)

select_state.on_change('value', update_plot)
layout = column(row(select_state, width=200), plot)    
curdoc().add_root(layout)

但是图表未显示。请引导我进行绘制

0 个答案:

没有答案