☰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

Stack bar chart selection of Hbar segment in javascript callback

Community Support
Nabster
Nabster

Is there a way to select a segment of the stacked bar and get the index of the bar and the segment name in a javascript callback?

I’m using standalone HTML file and hence python callbacks are not possible (I want to run in offline mode and bokeh server is an overkill so dont want to use that)

⌁   Link to post
Bryan
Bryan

Before going further it’s probably worth mentioning that with vbar_stack it is not possible to select only a single bar in a stack. All the bars in a given stack are selected. That is because vbar_stack puts all the rows in the same ColumnDataSource and selecting one bar sets a selection index that applies to all the other bars in that column (so they will also be selected). [1] Do you need selection on individual bars in a stack? If so, the first thing to change is to use individual vbar calls for each row, each with a different data source (so that selections are not shared).


  1. ref for details: Expose options to suppress linked selection/inspection when data sources are shared · Issue #7644 · bokeh/bokeh · GitHub ↩︎

⌁   Link to post
Nabster
Nabster

I understand, Thanks for the response.
I’m now trying to find the segment by using cb_obj.x and cb_obj.y, requires a bit of calculation but I think I can make it work.
Cheers!!

⌁   Link to post

End of archived discussion · Replies are disabled