A minimal reproducible example of this would be somewhat long, but the gist is this:
- I have a choropleth of the US (created via
fig.patches
) whose data is an ordinaryColumnDataSource
with a filteringCDSView
. The regions of the choropleth are US states. - This figure is configured to display a
HoverTool
tooltip when I mouse over individual states. - In
CustomJS
code, I have a javascript timer (fromsetInterval
) that periodically modifies the data source when I press a “play” button, creating an animation. This works as expected; once I press “play”, the map’s colors change automatically to show how states’ numbers have changed over time.
Now, the issue is that when I start the animation, mouseover a state, and then leave my cursor there without moving it, the tooltip’s values do not update as the animation plays and the data source updates. In order to force the tooltip to update, I have to jiggle the mouse slightly; it seems that it will only update in response to mouse movement and not to the source.change.emit()
call in my CustomJS
.
I tried to fake mouse movement by adding the following to the CustomJS
:
const bkElems = document.getElementsByClassName('bk')
for (let bkElem of bkElems) {
bkElem.dispatchEvent(new Event('mousemove'))
}
But this caused the hover tooltip to disappear altogether (until I moved it again, and then it would disappear again the next time the CustomJS
was called).
So, I am wondering how to connect a HoverTool
to a data source so that changes in the data source propagate to the HoverTool
without the mouse moving.