2017-09-01 4 views
1

コードは2つのクラスに分けられます - tablerepresentation.私はプロットにボケを使用しています。ウィジェットを使用することはできますが、同じ機能(ボーケ)にプロットすることはできません

ウィジェットをクリックすると、クラスtableが作成され、私に行と段落を与えるオブジェクトrepresentation.get_dia(),に移動します。 table

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.私がtable関数から呼び出した場合、プロットが表示されます。

答えて

1
#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)) 
関連する問題