Hi
I am using bokeh version 0.11.1 and running a python script using bokeh serve (eg. bokeh serve script.py) to render 4 bokeh plot figures each with 8-10 line glyphs as well as a bokeh widget checkbox group used for interacting and updated the plot figures.
When a checkbox is checked, a new line glyph is added to the plot and an entry is added to the legend if it hasn’t been created yet. When a checkbox is unchecked, I hide the line by changing the alpha attribute to 0 and remove the corresponding entry from the legend. If that same line that was hidden needs to be shown again, I change the alpha back to 1 and add the legend entry back.
This behavior works perfectly until I continuously check and uncheck boxes around 7-8 times. After this, the plots and lines start flickering randomly and the checkboxes don’t work at all anymore. Here’s the code I use to make the updates:
class LTVPlot(object):
def init(self, plot, lines, plot_legends, legend_labels, dataset):
self.plot = plot
self.lines = lines
self.plot_legends = plot_legends
self.legend_labels = legend_labels
self.dataset = dataset
self.handle = None
def add_handle(self, handle):
self.handle = handle
def update(self, indexes, push = True):
print(‘update_called’)
for i in range(len(self.lines)):
if self.lines[i] is not None:
self.lines[i].glyph.line_alpha = 0
self.plot.legend[0].legends =
legends_to_show =
legends_index_set = set(pick_legend_indexes(indexes, LINES_TO_SHOW-1))
for i, index in enumerate(indexes):
if self.lines[index] is None:
self.lines[index] = self.plot.line(
self.dataset.data[‘x%d’ % index], self.dataset.data[‘y%d’ % index],
legend = self.legend_labels.get(index, None),
alpha = 1,
line_width=DEFAULT_LINE_WIDTH,
line_color = pick_color(i, len(indexes) - 1))
self.plot_legends[index] = self.plot.legend[0].legends[0]
else:
self.lines[index].glyph.line_alpha = 1
self.lines[index].glyph.line_color = pick_color(i, len(indexes) - 1)
if index in legends_index_set:
legends_to_show.append(self.plot_legends[index])
self.plot.legend[0].legends = legends_to_show
When the flickering starts I don’t see anything printed to the js console. The update function isn’t being called either. What might be causing this issue?
Thanks,
Simon