Search code examples
pythondata-visualizationholoviews

Can't Save Bokeh Plot with Panel from PyViz Example


I have been working through the tutorials on pyviz.org. specifically the dashboard one

If I setup the example here: http://pyviz.org/tutorial/A2_Dashboard_Workflow.html

The save icon in the bokeh plot appears to be disabled. If I click area zoom, wheel zoom,or the reset icon they behave as expected. But the save button does nothing.

Is this intentional, able to be reset, or a bug on my side?

Ben


Solution

  • This is a fundamental limitation of browsers, the issue is that the map tiles in the background are making cross-origin requests to download the tiles. Browsers consider this a security issue and therefore mark the canvas as tainted. If you look at the browser console you'll see this error message when hitting save:

    Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
    

    In recent versions of GeoViews we therefore automatically disable the save tool if a tile source is present, but the website was built using an older version.

    TL;DR: It's a browser security issue and cannot be resolved afaik.