Hello- I had posted this topic to stackoverflow but it would seem this is a better place for it. I am really enjoying working with the Bokeh library but I am a bit stuck and perhaps I need to take a different approach and use direct JSCallback?
down votefavorite
I have created two Bokeh plots backed by two different datasets which reside in the same html page. Both of these plots can be filtered via a MultiSelect widget. The page appears to load up ok (both plots look correct). When I click on one of the selectors the associated plot is updated correctly, and the other plot disappears (I think it actually squishes down into a column but hard to be sure). If I then click on the other selector (associated with the missing plot) the plot reappears and the first plot disappears.
I am using two “create_plot” functions:
def create_plot_1():
#get data source, format plot, return plot
def create_plot_2():
#get data source, format plot, return plot
I have two selectors:
selector_plot_1 = MultiSelect(title="MyOption1", options=myList1, value='AAA'
selector_plot_2 = MultiSelect(title="MyOption2", options=myList2, value='ZZZ'
I created two update functions one for each data source. I also created two distinct rows and add them to the curdoc.
def update1(attr, old, new):
row1.children[1] = create_plot_1()
def update2(attr, old, new):
row2.children[1] = create_plot_2()
selector_plot_1.on_change('value', update1)
selector_plot_2.on_change('value', update2)
row1 = row(selector_plot_1, create_plot_1() )
row2 = row(selector_plot_2, create_plot_2() )
curdoc().add_root(row1)
curdoc().add_root(row2)
What am I missing here on the update/on_change method? Is there a way to specify that only the elements in a given row are to be updated? Interestingly I have added two datatables which correspond to the data in the plots and these update correctly and display as expected. Let me know if you need any more info, I really appreciate any help!
Dennis