☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

How to get a bar info by a call back

Community Supportbokeh
chenyulue
chenyulue

I have a bar chart with data such as x=["apple", "banana", "peach"] and top=[1, 2, 3]. Since bar chart does’nt support the SelectionGeometry event, I want to register a Tap event to get the bar info such as the x and y coordinates.

Since Tap event can give the click position, I want to compare the click position with the bars’ position, and return the bar info that matches the click position.

However, I have no idea how to get a collection of VBar glyphs with all the infomation such as position, line color, and so on.

⌁   Link to post
chenyulue
chenyulue

That’s what I want. For example, if I click the “apple” bar, a call back can be called to return the bar’s info such as x=apple, top=1as well as other visual properties like bar color.

You mean I should register the call back for CDS’s selected event?

⌁   Link to post
Bryan
Bryan
source.selected.js_on_change('indices', CustomJS(...))

like in the example linked above. Inside the CustomJS you can access the index for which bar was clicked, and then you can use this index to index into CDS columns for color or coordinate.

⌁   Link to post

End of archived discussion · Replies are disabled