Raghava kattamudi
Raghava kattamudi

Reputation: 87

Save Bokeh interactive plot to HTML file

I created a bokeh app with Select functionality and vbar chart in it. when i run the app on a bokeh server using bokeh serve --show myapp.py the program runs successfully. But when i try to save the same app as a HTML using output_file("Test.html"), Save() I'm able to successfully generate the HTML, but the Dropdown/ Select functionality and the interactivity is missing. Can someone advise if i'm missing something please.

Upvotes: 2

Views: 1923

Answers (1)

bigreddot
bigreddot

Reputation: 34588

EDIT: The earlier answer is still generally correct, however there have been recent developments such as PyScript that can afford the option to "run Python code" (including Bokeh server app code) in the browser in static HTML pages. The Holoviz/Panel team is on the forefront of this.


It's not possible to save Bokeh server applications as plain HTML. When you use the Select widget in a Bokeh server app, that triggers real Python code to execute. Browsers displaying plain HTML have no capability to run Python code! The Bokeh server is the Python process that executes the Python code for your Select.on_change widget callback. A Bokeh server must be running for the Select widget to trigger Python callback code when it is changed.

If you don't need to run actual Python code, then you could have a JavaScript callback for the Select widget using Select.js_on_change and a CustomJS callback instead. That could be saved as HTML (because it's just HTML and JavaScript).

Upvotes: 3

Related Questions