I’m having a tough time figuring out what you are doing here. glyph.value is not an attribute on bokeh plots. Based on context I think you are trying to toggle the lines on and off?
The easier thing to do is simply to set muted_alpha=0 which allows you to toggle them on via the legend:
If you really want to connect the Checkboxes you will have to write a slightly more complex callback, which iterates over the plot.renderers and sets them to invisible if they are not selected in the list of active checkboxes:
checkbox_widget.jscallback(args={'plot': lines['Robbery']}, value="""
for (var i = 0; i<plot.renderers.length; i++) {
plot.renderers[i].visible = cb_obj.active.indexOf(i) >= 0
}
""")
pn.Row(lines, checkbox_widget)
Thx for your reply -
Sorry for being unclear regarding the glyph.value - but your answer is great.
However I have a problem - since if the values of the series can be in a different scale (see bellow example) - I would like the plot to be re-rendered depending on the values in the visible series (similar to what is displayed in the bottom of the getting started docs ) which rerenders that plot each time the select is changed.
Do you know of such example?