How to highlight selected area when using Line glyph?

When I use the Circle glyph, the data points that are included in the selected area (using the BoxSelectTool) are being highlighted automatically.
When I switch to the Line glyph nothing happens.
How can I highlight the selected area of a line and get the selected data points?


I suspect this is the reason (from the Bokeh documentation for the line glyph).

The Line glyph is different from most other glyphs in that the vector of values only produces one glyph on the Plot.

Depending on your use case, you might try multi_line or segment glyphs.

Thanks for your reply!
I’m afraid the line glyph is the best fit in my case (I’m displaying X vs Y data). An interesting thing that I noticed is that when I use both the circle and line glyphs, I’m able to highlight the selected area of the line (see attached pic). It seems like it’s due to the fact that the circle glyph changes the source selected property automatically (something that the line glyph doesn’t do). The question is whether it is possible to make the line glyph do the same.
BTW, I tried to make the circle glyph invisible but then the selected area wasn’t being highlighted.


You might be able to make the line glyph achieve what you want but I have no idea how involved it would be. (I recently had to make my own replacement for Bokeh Div in a server application because of client redrawing/layout behaviors that I didn’t want.)

Your combination line/circle finding is interesting. Perhaps instead of making the circles invisible, try setting the circles’ line_alpha and fill_alpha properties both to 0.000. Then they will still be visible from the perspective of the software and any underlying machinery that uses the visible property, but will be invisible/transparent to the user.

Setting both line_alpha and fill_alpha to 0.0 worked…Thank you!!!