Hi,
I am trying to synchronize bokeh column data source for both server and client side. I am aware that the javascript operations run on client side updating the data source is synchronized by defining a new dict and assigning it to data attribute of a column data source and calling change.emit() on source. However, when I do that in my application, “cannot apply path to “some id” which is not in document anymore” error is thrown on server side. I dont know what is wrong with the code or implementation. You can find a similar case below. This one though works as expected, mine is throwing some error and I cannot get the same values on server side. Since the original application code is very long, I rather post a similar case as below. Could you please explain me what error means?
from bokeh.plotting import figure, output_file, show
from bokeh.models import CustomJS,ColumnDataSource,Slider
from bokeh.layouts import row,column
from bokeh.plotting import figure,curdoc
from bokeh.models.widgets import Panel, Tabs, Select,Button
output to static HTML file
doc = curdoc()
source = ColumnDataSource(dict(x = [1, 2, 3, 4, 5],y=[6, 7, 2, 4, 5]))
callBack = CustomJS(args=dict(source = source),code = “”"
var data = source.data
data[“x”] =
data[“x”].push(1)
data[“y”] =
data[“y”].push(1)
source.data = data
source.change.emit();
“”")
def newData():
print(source.data[“x”],“x_values”)
button = Button(label=“What is source’ s value”)
button.on_click(newData)
p = figure(plot_width=400, plot_height=400)
p.js_on_event(‘tap’, callBack)
add a circle renderer with a size, color, and alpha
p.circle(“x”, “y”, size=20, color=“navy”, alpha=0.5,source = source)
show the results
doc.add_root(column(p,button))
Thanks.