Hi,
I am trying to publish on the same webpage multiple documents that I want to be able to update as new data arrive.
I have multiple object that receive and parse data, and each one should be able to create new charts in its own document.
I am able to create new documents, create charts in them and push them on the website, but then I cannot interact with the documents anymore.
What I do to create them is to start a new session each time:
self.session = Session(
name=self.doc_name, root_url=self.server_url,
load_from_config=False)
output_server(self.doc_name, session=self.session, clear=False)
then I can create figures and push them online:
fig = figure(title=key, plot_width=1000)
fig.quad(top=std_hist_top, bottom=std_hist_bottom,
left=[el + 0.47 for el in range(nhid)],
right=[el + 0.53 for el in range(nhid)],
fill_color=‘black’, line_color=“black”)
push()
But once another object creates a second session for a second document, the first object cannot modify (add new charts or add new data to existing charts) the first document anymore.
As far as I understood the session represents only the connection to the server, which in my case could be shared among the data parsing objects.
I tried to share the same session among the objects, but in this case I don’t know how to create a new document anymore.
This is what I did:
self.session = cursession()
bokeh.plotting._default_document = Document()
self.document = curdoc()
fig = figure(title=key, plot_width=1000)
fig.quad(top=std_hist_top, bottom=std_hist_bottom,
left=[el + 0.47 for el in range(nhid)],
right=[el + 0.53 for el in range(nhid)],
fill_color=‘black’, line_color=“black”)
push(session=self.session, document=self.document)
With this code I am not able anymore to create new documents online (it seems like the Document I am writing in is an object not linked to any session/server) and somewhere in the execution I get JSON errors (No JSON object could be decoded).
Any help would be much appreciated.
Thank you