I'm trying to upadte a vbar_stack plot in bokeh everytime I chosse a different category from a dropdown, but as legend_label
is inside the vbar_plot, I can't update it in the update function.
I'll add the code to be more clear
def make_stacked_bar():
colors = ["#A3E4D7", "#1ABC9C", "#117A65", "#5D6D7E", "#2E86C1", "#1E8449", "#A3E4D7", "#1ABC9C", "#117A65",
"#5D6D7E", "#2E86C1", "#1E8449"]
industries_ = sorted(np.unique(stb_src.data['industries']))
p = figure(x_range=industries_, plot_height=800, plot_width=1200, title="Impact range weight by industry")
targets = list(set(list(stb_src.data.keys())) - set(['industries', 'index']))
p.vbar_stack(targets, x='industries', width=0.9, legend_label=targets, color=colors[:len(targets)], source=stb_src)
Here is the update function:
def update(attr, old, new):
stb_src.data.update(make_dataset_stack().data)
stb.x_range.factors = sorted(np.unique(stb_src.data['industries']))
How can I update the actual data and not only the x axis? Thanks!