data = cb_data.source.data;
console.log("clicked");
console.log(cb_data.source.selected.indices);
item = data.cl[cb_data.source.selected.indices[0]];
if(item != undefined) {
// do something
}
Most of the time, a click (on a point on the figure) is registered, but selected is empty! I have to be hovering perfectly over it in order for selected and TapTool to agree. Am I accessing data from the wrong selected var?
This may just be an order of operations concern. Things have to happen in some order, and offhand I have no idea if there’s any reason to suspect whether the CDS selection must be set before or after a tap tool callback is executed. A complete small example would be useful to do some quick investigation.
Ah ok, happy to make one, but then are you saying that checking the ‘selected’ is the correct way of figuring out what was tapped? It seems weird to me that the taptool is capable of only activating when a glyph is clicked, yet it isn’t capable of providing the data/index that glyph represents.