剧情不显示虚化

问题描述 投票:0回答:1

我想用Bokeh和python把一个报表导出为HTML。谁能告诉我,为什么我的代码不能用?我试着打印一个简单的Div,成功了,但是只要我把图放进去,浏览器还是会打开,但是什么都看不到。是不是不能继承图?

我把它缩小到相关的部分。

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__()

谢谢你的帮助。

python bokeh
1个回答
0
投票

尝试添加

__subtype__ = 'PlotObject'
__view_model__ = 'Plot'

的身体 PlotObject 类。

但我建议不要扩展Bokeh对象,除非你想通过编写自定义JavaScriptTypeScript实现来提供一些UI行为。

© www.soinside.com 2019 - 2024. All rights reserved.