首先,我在geogr之外创建了一个散点图。坐标。如果我单击这些圆中的一个,该散点图旁边的第二个线状图将根据我所单击的圆显示更多信息。这意味着我必须用一个新的ColumnDataSource来更新线条图中显示的当前a。但是,如果我点击其中一个圆圈,当前源代码将不会更新。线状图仍然显示了旧源的数据集。
我将尝试给您一个简短的示例,说明我到目前为止所做的工作:
def callback(attr, old, new):
# Depending on what circle i've clicked i start a SQL request
# to gain my dataset i want to plot and the new title of the diagram.
# To change the title actually works:
line_plot.title.text = 'new_title'
# "source_new_values" is a ColumnDataSource created out of a
# SQL-request of my database.
# To change the current source doesn't work. The line-plot is still
# showing the old dataset.
source_current_values = source_new_values
scatter_plot = figure(x_axis_label='lat', y_axis_label='lon')
scatter_plot.circle(x='long', y='lat', source=source_coordinates)
# I use the indices to identify what circle was clicked.
source_coordinates.selected.on_change('indices', callback)
line_plot = figure(x_axis_label='time', x_axis_type='datetime',
y_axis_label='values', title='title')
line_plot.line(x='date', y='value', source=source_current_values)发布于 2019-06-16 20:07:04
tat问题的解决方案是我不能通过ColumnDataSource更新源代码,而是通过字典使用:
source_current_values.data = Dict("some content")https://stackoverflow.com/questions/56610329
复制相似问题