How can I programmatically select a Polygon from a gv.Polygons in a callback ?
I have a Button, that, when clicked, will trigger a callback that increases the selection index.
To be precise, I don’t want to retrieve a Polygon’s data after it is selected by the user on the plot.
I want to “trigger” a Tap selection event programmatically on a specific index.
Previously I did like this but it is quite heavy so I hope there is (with recent versions) a better way to do this:
ftRenderer = plot.handles['glyph_renderer']
def changeSelected(attr, old, new):
global ftRenderer
if ftRenderer:
newSource = copy.copy(ftRenderer.data_source)
newSource.selected.indices = new
ftRenderer.data_source = newSource
ftRenderer.view.source = newSource
Tried renderer.get_plot(ft).selected = [idxSelect]
without success
I’d suggest brushing up on how dynamic plotting works in HoloViews by reading the Live Data user guide and maybe some following on from that. Here’s one way of doing what you are trying (with some random data since I don’t have your footprints_data):