☰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

Adding Swatch + Multiple Columns in a Single Tooltip Field

Community Supporthover
Gen
Gen

I have a simple CDS with two columns (title and fill_color)

I want to create a hover tooltip like the below (one single line with the title and swatch).

tooltips=[("Title", "@title $swatch:fill_color")]

This produces a tooltip with just the swatch, is there anyway to have the title in the same line as the swatch?

⌁   Link to post
Bryan
Bryan

Noting that these days it might also be possible to draw a similar color element using a CustomJSHover.

Edit: well, perhaps {custom} and {safe} cannot currently be combined.

⌁   Link to post
Bryan
Bryan

I really appreciate your enthusiasm @Gen! In this case, however, I actually plan to open a discussion about deprecating and removing the $swatch special variable, and replacing it with techniques that are are more in line with modern Bokeh. The old $swatch has a number of deficiencies:

  • not configurable at all (size, shape, etc)
  • has obscure syntax that is hard to document/discover
  • adds complexity internally that is undesirable

Better would be to make CustomJSHover a workable option so that users can self-serve any needs they have, or else add actual formatter models for color values, that can be used in the same way that all other custom formatters work these days.

If you want to join the Bokeh dev slack we can try to chat about other possible issues based on you interests/experience.

⌁   Link to post
Gen
Gen

@Bryan Thanks!
I’ll join the devstack…I just want to slowly work my way up thru the codebase.

Regarding $swatch, completely understood. I thought it was fairly clunky that this, and only this, $swatch field needed a colon to another color column. Removing/rewriting it seems correct (at least from the user perspective, haven’t looked at the code)

⌁   Link to post

End of archived discussion · Replies are disabled