代码分为两类 - table 和 representation。我正在使用 bokeh 进行绘图。
当我点击一个小部件时,它会创建一个类 table 并将我带到对象 representation.get_dia(), 它应该给我一行和一个段落。
表中的代码片段
def update_on_button_click():
print(final_data)
rep=representation(final_data)
rep.get_dia()
get_dia() 函数 -
def get_dia(self):
curdoc().clear()
from bokeh.models import Paragraph
p2 = Paragraph(text='Under Construction',width=200, height=100)
p1=figure()
p1.line([1,2,3],[1,2,3])
curdoc().add_root(row(p2,p1))
该函数在浏览器中显示段落但不显示情节。
发生这种情况有什么原因吗?
P.S 如果我从 table 函数调用它,该图是可见的。
请您参考如下方法:
#from bokeh.plotting import figure --- adding this (even though I had added
#this at the starting itself)
def get_dia(self):
#curdoc().clear() --- And Removing this solves the problem
from bokeh.models import Paragraph
p2 = Paragraph(text='Under Construction',width=200, height=100)
p1=figure()
p1.line([1,2,3],[1,2,3])
curdoc().add_root(row(p2,p1))
