Fix Bokeh output
Lock Y axis of Bokeh HTML output
This commit is contained in:
parent
51ee9cd76f
commit
e6a54d96c2
1 changed files with 12 additions and 2 deletions
|
@ -4,6 +4,10 @@ from io import BytesIO
|
||||||
|
|
||||||
import holoviews as hv
|
import holoviews as hv
|
||||||
|
|
||||||
|
from bokeh.embed import file_html
|
||||||
|
from bokeh.resources import INLINE
|
||||||
|
from bokeh.models.tools import PanTool, WheelZoomTool
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
@ -17,9 +21,15 @@ def pildata(image):
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def hvhtml(hvobject):
|
def hvhtml(hvobject):
|
||||||
renderer = hv.renderer('bokeh')
|
bokeh = hv.render(hvobject)
|
||||||
html = renderer.html(hvobject, resources="inline")
|
|
||||||
|
|
||||||
|
pan_tool = bokeh.select(dict(type=PanTool))
|
||||||
|
pan_tool.dimensions = "width"
|
||||||
|
|
||||||
|
zoom_tool = bokeh.select(dict(type=WheelZoomTool))
|
||||||
|
zoom_tool.dimensions = "width"
|
||||||
|
|
||||||
|
html = file_html(bokeh, INLINE)
|
||||||
html = html.replace("http://localhost:5006/static/extensions/panel/css", "/static/frontend/vendor/panel")
|
html = html.replace("http://localhost:5006/static/extensions/panel/css", "/static/frontend/vendor/panel")
|
||||||
|
|
||||||
return html
|
return html
|
||||||
|
|
Loading…
Reference in a new issue