【发布时间】:2020-11-26 22:02:08
【问题描述】:
我正在尝试构建一个网格图,该网格图根据使用散景从“选择”小部件中选择的值进行更新。 图表有效,但小部件和图表之间没有交互。我不知道该怎么做。目标是使用“选择”更新 dfPlot,然后按照其余步骤操作。
这是我目前所拥有的:
output_file('layout.html')
select = Select(title="Option:", options= list(dfExpense['Ident'].unique()), value= "VALUE")
def update_plot(attr, old, new):
dfPlot = dfExpense[dfExpense['Ident'] == select.value]
select.on_change('value', update_plot)
d = []
for x in dfPlot['Account'].unique():
d.append(f's_{x}')
plt = []
for i, x in enumerate(dfPlot['Account'].unique()):
dftemp = dfPlot[dfPlot['Account']==gl]
source1 = ColumnDataSource(dftemp)
d[i] = figure(plot_width = 250, plot_height = 250)
d[i].circle('X', 'Amount', source = source1)
plt.append(d[i])
grid= gridplot([i for i in plt], ncols = 6)
l = row(grid, select)
show(l)
curdoc().add_root(l)
谢谢!
【问题讨论】: