On Tue, Nov 11, 2014 at 3:14 PM, David Jung [email protected] wrote:
Unrelated now that I understand better your question… but it is not totally unrelated
I have to correct myself here, we actually expose the session object… I forgot about that…
OK, let’s try this:
from bokeh.plotting import autoload
from bokeh.session import Session
from bokeh.document import Document
s = Session()
d = Document()
return autoload_server(d.context, s)
snippet = load_plot(‘my_ts_plot’)
def write(fname, snippet):
with open(fname, “w+”) as f:
So, with d.context you have the reference you are asking for…
Hope it helps!
On Tue, Nov 11, 2014 at 1:01 PM, Damian Avila [email protected] wrote:
So, are you asking how to get the plot object?
From a document id or name string, yes.
Because you already answered here: https://github.com/bokeh/bokeh/issues/829#issuecomment-61876977
No, unrelated. That was about how to expose the plot object from a chart object in-process.
In that case I already had a chart object and just needed to extract the plot object. Now, I’m writing an independent web-app that has nothing to do with generating the charts or plots - it just needs to lookup the plot/chart document by name from the bokeh-server. As the title says, I don’t understand how to go from nothing but a string name for a document on the bokeh-server to a script snippet I can insert into a HTTP response and have that (in conjunction with the Bokeh JS lib) actually fetch and display the plot from the server.
About the session, we don’t currently expose the session object in charts, this is something we need to fix, can you open an issue for that?
There is already an issue open for that, though it won’t help in this case. If we forget about charts and just consider plots, the issue is the same - how can I get from a string name of a document containing a plot that has been previously stored in the bokeh-server by an independent process, to a JS snippet to embed into a HTTP page such that it’ll display inline?
The couple lines of code I pasted maps from the document name to the document UUID (by calling the bokeh-server API through the client code), but from there I don’t know how to generate something like:
(I can’t even manually generate that as I don’t know what the modelid is nor what the UUID suffix on the URL represents)