HoverTool model callback property #12739
-
Hi, trying to wrap my head around the HoverTool model's callback property, specifically the reasoning behind limiting it to one callback: Like, why is it:
and not something like:
or even why does it exist at all, and not be something event based, like
The intricacies/possibilities are pretty overwhelming and I don't know exactly what the best way forward might be, or if there's already a workaround i'm missing. Having access to cb_data and cb_obj in each callback really shouldn't matter --> that would just be the same thing in each CustomJS that's attached. Then I thought of workarounds. If there's no hover event", maybe I can use js_on_change? Then that reminded me of the classic "selection" callback question that gets asked all the time, where the nuance is that you don't trigger CustomJS on selection event, but instead trigger it when the selected indices of the underlying datasource changes--> e.g. But there is no So I guess I'm kinda paralyzed with the options. Is there a workaround/other option I'm missing? Is a feature request in order for this, and if so, what should that look like? As always, thanks so much for all your work. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
History, no other reason. Properties for IIRC the thing that Think the question about workarounds is specifically for multiple callbacks on one hover? I don't have any especially good suggestions at present. I suppose you could stuff two (or however many) distinct cc @bokeh/core |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response. Yeah, chaining callbacks gets messy in a hurry. FYI my workaround was simply to add js_on_event('mousemove',cb) to the figure holding the hovertool, and then cb was something like:
I figured since the Hovertool.callback hits on every mousemove anyway, I might as well just mimic it on the figure with an if statement checking for inspection. This works fine, I can add n callbacks this way without needing them executing inside each other. I do agree it'd be good to modernize the HoverTool callback, one way or another. |
Beta Was this translation helpful? Give feedback.
Thanks for the response. Yeah, chaining callbacks gets messy in a hurry.
FYI my workaround was simply to add js_on_event('mousemove',cb) to the figure holding the hovertool, and then cb was something like:
I figured since the Hovertool.callback hits on every mousemove anyway, I might as well just mimic it on the figure with an if statement checking for inspection. This works fine, I can add n callbacks this way without needing them executing inside each other.
I do agree it'd be good to modernize the HoverTool callback, one way or another.