Bokeh Architecture¶
Documentation¶
Model-view design¶
- high-level “model objects” (representing things like plots, ranges, axes, glyphs, etc.) are created in Python, and then converted to a JSON format
- the JSON data representation of the model, are rendered to view/vis by the client library, BokehJS. When you look at a saved html file created by Bokeh, you can basically see that JSON data object, and a couple of Bokeh.js function calls to render that data object.
- this flexible and decoupled design offers advantages, for instance it is easy to have other languages (R, Scala, Lua, ...) drive the exact same Bokeh plots and visualizations in the browser.
Server-client design¶
http://bokeh.pydata.org/en/latest/docs/user_guide/server.html
Tornado and websocket-based server introduced in Bokeh 0.11
Start a Bokeh Server to server myapp (Bokeh Application):
bokeh serve --show myapp
Use callback and event loop to update the application preriodically
Deploy a local application: reverse-proxy with a dedicated webserver, such as DJango and Nigix
So why use Django, since Bokeh server already uses Tornado?¶
Many reasons really, see a dicussion here: http://stackoverflow.com/questions/6247735/is-tornado-a-replacement-to-django-or-are-they-complementary-to-each-other
Excerpt: Pros for Django:
- it’s a fuller stack (admin pages for example are very easy to implement)
- it’s much more established (plugins, tutorials, etc.)
- it’s better documented
- its ORM is very nice
Bokeh Dashboard¶
What is Dashboard? from wiki: In real-world terms, “dashboard” is another name for “progress report” or “report.” Often, the “dashboard” is displayed on a web page that is linked to a database which allows the report to be constantly updated.
More design principles: https://webapphuddle.com/beginners-guide-to-dashboard-design/
A Bokeh Dashboard is a category of Bokeh app, used as an interface for users to quickly visualize and update a specific dataset or database.
An example code to create Bokeh Dashboard :
https://github.com/bokeh/datashader/blob/master/examples/dashboard/dashboard.py