Icon save png -> html


is there a way to modify the output format of the save icon button to
retrieve my chart in html ?
Or eventually add a new button to implement this functionality ?

Hi @odadoun the short answer is no, since all the SaveTool does is convert the HTML raster canvas for one plot in to a PNG. But it’s not really clear what exactly you are hoping to be accomplish (I can think of at least a half a dozen clarifying questions about what “save my chart to HTML” might mean, specifically). Perhaps you can describe your actual requirements and what you’d like to see possible in more detail.

I need a html format file to be able to display my chart inside a web page.
Basically I need have a button to the following stuff:

from bokeh.plotting import output_file

Do you think is manageable ? :face_with_monocle:

Your use case is still unclear. You press a “save to HTML” button, are you trying to save the entire current page? Or just “a single plot”? If is the former, that maybe seems doable, and there are probably answers on Stack Overflow with JS you could put in a CustomJS callback for a Button. If it is the latter, that seems much harder. You would need to construct, in JavaScript, an completely new page that includes all the BokehJS resource loading, and also just the subset of the page you want to save. I’m not sure how that would work.

I would like to save a single html plot (so the harder one :zipper_mouth_face:).
For instance the first plot presented here:

and all the other plots (to have access to the corresponding html you need to click on the png figure)

I’m afraid I don’t have any specific advice to offer beyond the brief plausible outline I gave above. It’s a difficult problem, and not one I can devote time to at present.

1 Like