You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a dashboard for visualization of large time series. The combination of Jupyter + Bokeh + Holoviews/Datashader is perfect for prototyping and data exploration. However, I would like to embed some graphs on more user-friendly web pages using Flask.
Deploying bokeh apps without datashading using script, div = components(bokeh_figure) in Flask works perfectly fine.
Visualizing bokeh apps with datashading in Jupyter or using bokeh serve also works fine, e.g. with doc = hv.renderer('bokeh').server_doc(datashaded_hvObject).
Where I'm running into issues is combining these two steps. I can render a datashaded bokeh app in Flask like so: renderer = hv.renderer('bokeh').instance(mode='server') hvplot = renderer.get_plot(datashaded_hvObject) script_data, div_data = components(hvplot.state)
... but this of course only shows a single rasterized frame and is missing the callback to update the plot when someone is interacting with it.
Based on some tutorials, I'm running a bokeh server from my Flask script as follows:
With the main Flask @app.route set as follows: session = pull_session(session_id=None) bokeh_script = server_session(None, session_id=session.id) return render_template('test.html', script_data=bokeh_script)
This is not working though as it doesn't appear to connect to the correct session ID: Cannot pull session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command). I'm also not sure this would actually get me a working interactive session.
I realize this is not a strict Holoviews question but I figured it may be useful to other Datashader users. Let me know if it's out of scope!
The text was updated successfully, but these errors were encountered:
I don't know offhand how to resolve the issue you have pulling the session document but I can say that a docs PR explaining how to use holoviews/datashader together with flask would be very welcome!
I am working on a dashboard for visualization of large time series. The combination of Jupyter + Bokeh + Holoviews/Datashader is perfect for prototyping and data exploration. However, I would like to embed some graphs on more user-friendly web pages using Flask.
script, div = components(bokeh_figure)
in Flask works perfectly fine.bokeh serve
also works fine, e.g. withdoc = hv.renderer('bokeh').server_doc(datashaded_hvObject)
.renderer = hv.renderer('bokeh').instance(mode='server')
hvplot = renderer.get_plot(datashaded_hvObject)
script_data, div_data = components(hvplot.state)
... but this of course only shows a single rasterized frame and is missing the callback to update the plot when someone is interacting with it.
Based on some tutorials, I'm running a bokeh server from my Flask script as follows:
bokeh_process = subprocess.Popen(['bokeh', 'serve', '--allow-websocket-origin=localhost:5000','test.py'], stdout=subprocess.PIPE)
With the main Flask
@app.route
set as follows:session = pull_session(session_id=None)
bokeh_script = server_session(None, session_id=session.id)
return render_template('test.html', script_data=bokeh_script)
This is not working though as it doesn't appear to connect to the correct session ID:
Cannot pull session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command)
. I'm also not sure this would actually get me a working interactive session.I realize this is not a strict Holoviews question but I figured it may be useful to other Datashader users. Let me know if it's out of scope!
The text was updated successfully, but these errors were encountered: