I have a bokeh server app where users upload a csv file and plots are generated using python code based on the data and some user inputs that are obtained through slider widgets.
If you click on the save icon a bunch of jpgs get downloaded. Is there a way to save a static html that you can manipulate using the bokeh tools? I want to be able to save an instance after the user has done all their manipulations to the data (through the sliders, etc.).
@Bryan Does using output_file save the current state of the widgets and plot in the html? Like if I save a html after manipulating the plots, would the saved html file reflect the changed state or would it default to the state when the server app starts with?
You don’t need to call output_file with save, you can just pass save a filename, which is what I recommend in this scenario. And although I have not tried, I would expect the current state to be what is saved (I don’t know how anything else would be possible).
When I call save I get this message:
call to save() ignored when running scripts with the ‘bokeh’ command
Also is there a way to have the user set the filename and save destination? I was thinking you could do something through the fileinput widget, but am not really sure.
Ah, I forget about. Perhaps that restriction can be lifted or eased. It was put in place a long time ago under different circumstances. For now I would then suggest using file_html instead, to generate the HTML as a string which you can save using standard Python file I/O functions.
Also is there a way to have the user set the filename and save destination? I was thinking you could do something through the fileinput widget, but am not really sure.
Just by offering TextInput fields, I think. Built-in browser file choosers do not expose the actual file path for security reasons, only the chosen file contents are available. There is nothing we can do on our end about that.