Hi Bokehers,
If have a couple of circles that I want to update the color (for my specific problem I have thousand of circles) .
Using Slider or TextInput it is quite easy:
plot = figure(plot_width = 300, plot_height = 300)
src=ColumnDataSource(dict(x=[1, 2, 3],y=[3, 7, 5],color=3*['blue']))
circ_slider = Slider(start=0, end=2, value=1, step=1)
plot.circle('x', 'y', size = 20, color = 'color', alpha = 0.6, source=src)
def thecallback():
return CustomJS(args=dict(source=src,circ=circ_slider),
code="""
const data = source.data;
var col = data['color']
var i = circ.value;
for (let i = 0; i < col.length; i++) {
col[i] = 'blue'
}
col[i] = 'red';
source.change.emit();
""")
circ_slider.js_on_change('value', thecallback())
show(row(plot,circ_slider))
In order to make an animation I don’t want to use Slider, TextInput …
Is there a Bokeh Python command to inject some JS ?
The order of the circle color are depending from a parameter defined in a pandas DataFrame.
Thanks ![]()
PS:
I have posted the question on stack but I think It wasn’t clear