☰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

CustomJS and CustomJSHover --> args argument not consistent

Community Support
Bryan
Bryan

@gmerritt123 The original motivating use-case for the args dict was specifically (and only) to be a mechanism for cloning Bokeh model objects across the Python → JS boundary. I think somewhere along the line some of the property definitions were loosened in some places, incidentally, as part of other work, which would allow more types to be passed-in in those places. There’s probably no reason CustomJSHover could not also be updated (i.e. it’s probably only the way it is now because that’s the way it was when it was first created). Please feel free to make a GitHub Issue to propose bringing all of the various args property definitions into better alignment.

⌁   Link to post
Bryan
Bryan

Yah that’s a reasonable start, we might re-tag it as a task since it is more or less just some housekeeping that has been neglected.

I’m gonna have to make one hell of a janky workaround in the meantime :joy:

FWIW a common approach in the past was to use string formatting/substitution on the text of the code block.

⌁   Link to post
gmerritt123
gmerritt123

I was thinking using a CDS with one long columns to mimic a dictionary, which would more or less cover me:


#jank
dum = ColumnDataSource(data={'v':['something']})
cbh = CustomJSHover(args=dict(d=dum)
                    ,code='''
                    var janky_lookup = d.data['v'][0]
                    ''')
⌁   Link to post
Bryan
Bryan

That’s definitely an option. A less “janky” option would be to define a DataModel with named properties you want, then that DataModel instance could be passed in args. See:

⌁   Link to post

End of archived discussion · Replies are disabled