I am trying to update a very simple columndatamodel in the callback but documented solutions on triggering change
do not seem to work, code:
source = ColumnDataSource(data=dict(classification=classification, counts=counts,
type_color=[colordict for x in colordict],
font_color=[bokutils.contrasting_text_color(colordict) for x in colordict],
subgroups=[subdict for x in subdict]))
def update(source=source, slider=date_range_slider, window=None):
data = source.data
print ('slider0',slider.value[0])
print (source.data['counts'])
i=0
arr=source.data['counts']
al=len(arr)
print (al)
while (i < al):
arr[i]=arr[i]+50
i=i+1
source.trigger('change');
print (source.data['counts'])
print ('slider1',slider.value[1])
return
results in a python error:
source.trigger(‘change’);
TypeError: trigger() takes at least 4 arguments (2 given)
Changing the trigger call to :
source.trigger(‘change’,source,source,source);
results in:
VM1492:20 Uncaught TypeError: source.trigger is not a function
at cb (eval at i._make_func (bokeh-0.12.14.min.js:1), :20:12)
at eval (eval at i._make_func (bokeh-0.12.14.min.js:1), :25:1)
at i.execute (bokeh-0.12.14.min.js:1)
at e. (bokeh-0.12.14.min.js:1)
at t.emit (bokeh-0.12.14.min.js:1)
at e._setv (bokeh-0.12.14.min.js:1)
at e.setv (bokeh-0.12.14.min.js:1)
at e.set [as value] (bokeh-0.12.14.min.js:1)
at e._slide (bokeh-widgets-0.12.14.min.js:1)
at Object. (bokeh-widgets-0.12.14.min.js:1)
but the code before this executes fine:
slider0 1473980224165
(4) [1989, 513, 114, 107]
So the source (Columndatastore) seems to have a trigger method that does something undocumented.
What I really need is just for the plot to redraw with the new data set in the update function and I cannot
figure out how to do this simple thing. A plot.revalidate() function for example.
There has to be a way to trigger an update of the plot from the python callback as it is translated to JS
it should just do the appropriate event to tell the plot to update itself with the new source data.
Anybody figured out how to do this? It needs to be general so that it applies to other on_change callbacks?
I find it a bit strange that the documented trigger does not work and nobody seems to have asked this question?
Kind regards,