有人可以分享多选散景图的基本版本吗?
我有一个在Chrome中完美运行的界面,但在选择时崩溃IE。 Chrome和IE中的控制台没有记录任何错误。
这是一个非常简单的案例
这是更新功能的一部分
def update():
engine = create_engine('sqlite:///C:/....../enps.db')
connection=engine.connect()
metadata = MetaData()
responses = Table('detail_view', metadata,
Column('business_unit', String),
Column('location', String),
Column('job_function', String),
Column('opp', String),
Column('opp_detail', String),
Column('yes', REAL),
Column('no', REAL),
Column('unsure', REAL),
Column('total', REAL)
)
myLocations = [i for i in m_select.value]
myLocation = myLocations[0]
if (myLocation != "All"): #specific location, all bu, all jf
这是初始化multiselect并调用on_change属性的代码:
mlocations = [ row[0] for row in pd.read_csv('.../location.txt',
header=None).values.tolist()]
m_select = MultiSelect(title="Location", value=mlocations, options=mlocations)
m_select.on_change('value', lambda attr, old, new: update())
m_select_widgetbox = widgetbox(m_select)
l=gridplot([[m_select_widgetbox],[header], [plot3], [plot2]])
IE崩溃了。但随后使用正确更新的图表刷新。 Chrome工作得很好。
由于
我已经将其归结为最简单的代码,只是为了查看是否存在某种回发错误。我不明白这段代码可能出现的问题。同样,它在Chrome中运行良好。
from bokeh.layouts import widgetbox, gridplot
from bokeh.models.widgets import Paragraph, MultiSelect
import pandas as pd
from bokeh.io import curdoc
def update(attrname, old, new):
myString = ''
for i in m_select.value:
myString += '\n' + i
myText.text = myString
mlocations = [ row[0] for row in pd.read_csv('C:/....../location.txt', header=None).values.tolist()]
m_select = MultiSelect(title="Location", value=mlocations, options=mlocations)
myText = Paragraph(text='Initial Text', width=1200)
m_select.on_change('value', update)
m_select_widgetbox = widgetbox(m_select)
l=gridplot([[m_select_widgetbox],[myText]])
curdoc().add_root(l)
curdoc().title = "wtf"
使用IE运行散景服务器,更改选择,然后你就可以了......