Backgroud: consumer data visualization app, scaling from a prototype to production.
Current setup: Front-end (React) takes some user input (say car make and model) and sends it to the backend as POST request. Backend (python/FastAPI) parses the request, runs some DB queries and calculations, generates a Bokeh plot and sends it to the frontend as JSON/string. The frontend shows this JSON in its specified div, and we’re done. If the plot requires callbacks, they are implemented as CustomJS, with the callback again hitting that same API (with new args collected from the page, as needed), getting JSON and replacing the current plot with the newly received one.
Contemplated alternative setup:
Backend sends only data and Bokeh plot is generated on the client side with BokehJS.
- What are pros and cons of the alternative?
- How does the JS interface of Bokeh compare to Python, in terms of:
- anything else?
- Will it be harder or easier to maintain, extend, abstract/refactor these plots in JS as compared to Python?
- Is client- or server-side plot generation better suited to our use case where user interactions are not visual (natively supported by Bokeh like scroll etc.) but require new data from the server?
- Anything else we need to know?
Any advice would be much appreciated.
(the question is also on SO)
Every feature or capability that (Python) Bokeh affords is ultimately actually implemented by BokehJS. So the short answer is that there is no difference at all in features or flexibility or performance (modulo any differences between your serialization overhead and Bokeh’s).
All of the differences really come down to maturity and documentation, with come caveats:
There is an exact 1-1 correspondence maintained for all Bokeh models and properties, and this is strictly maintained under continuous test. i.e. a Python
DataRange1d and a BokehJS
DataRange1d will always have the same properties, with the same default values. So you can rely on the “bokeh.models” JS API and you could reasonably use the Python reference as a BokehJS reference in this sense.
There’s also a partial clone of “bokeh.plotting” in BokehJS (in a separate
bokeh-api.js bundle), this is probably fairly stable, but again you’d need to rely on Python docs as a starting point. But the BokehJS version of “bokeh.plotting” does not currently have full parity with the Python API.
BokehJS is still under very heavy development, and the rest of the API that is not models/properties or
bokeh-api.js is not nearly as stable nor really documented at all. That’s probably mostly fine, all of the rest of BokehJS should really probably be considered private implementation.
All of the existing BokehJS docs are really just what’s on this page: BokehJS — Bokeh 3.2.1 Documentation Notably absent is any specific guidance for integrating BokehJS with node applications or popular frameworks like React or Vue.
All that said, people can and do already use BokehJS directly with success, but there may be some initial costs to figure out how best to integrate it in your project.
cc @mateusz for any further comments
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.