情节不与散景一起显示

编程入门 行业动态 更新时间:2024-10-26 11:30:12
本文介绍了情节不与散景一起显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用Bokeh和python将报告导出为HTML.谁能告诉我,为什么我的代码不起作用?我尝试打印一个简单的Div并成功,但是一旦包含绘图,浏览器仍然会打开,但是看不到任何内容.不能继承图吗?

i am trying to export a report as HTML using Bokeh with python. Can anybody tell me, why my code is not working? I tried to print a simple Div and succeeded, but as soon as i include plots, the browser still opens, but nothing is visible. Is it not possible to inherit Figure?

我将其简化为相关部分:

I reduced it to the relevant parts:

def export_html(self): plots=[] plots.append(PlotObject(self.plot_attributes[4])) VisuLog(plots) from bokeh.plotting import Figure, show, output_file class VisuLog(): def __init__(self,plots): self.plots = plots filename="Report_" output_file("visu_out\\"+ filename + ".html", title=filename) show(self.plots) # open a browser class PlotObject(Figure): def __init__(self,plot_attributes): super(PlotObject, self).__init__()

谢谢您的帮助.

推荐答案

尝试添加

__subtype__ = 'PlotObject' __view_model__ = 'Plot'

PlotObject 类的主体.

但是我建议不要扩展Bokeh对象,除非您想通过编写自定义JavaScript/TypeScript实现来提供一些UI行为.

But I would advise against extending Bokeh objects unless you want to provide some UI behavior by writing custom JavaScript/TypeScript implementation.

更多推荐

情节不与散景一起显示

本文发布于:2023-11-17 03:49:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608719.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不与   情节

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!