Data space bounds of AnnularWedge glyph

I’m looking to use a DoubleTap event to trigger a CDS update with AnnularWedge glyphs. DoubleTap returns the x/y coordinates for the data space, which I would like to use to determine which wedge was DoubleTap’d on.

Is there a way to access the bounds (data space) of each wedge? The methods/attributes in the docs don’t seem to expose them.

Alternatively, if another method will achieve what I’m trying to do, I’m interested in that as well (the less JS the better :slight_smile: )

Thanks!

I thought the TapTool could be configured for double-taps instead of single taps, but that does not seem to be the case. That’s too bad because just using the built-in selection/hit-testing machinery would be alot easier. In any case, the data you are asking about must already be availalble to you. You would have had to supply the center coordinates x0, y0, inner/outer radius and start/end angles in the first place. You will have to use this information to determine if the x,y data coordinate from the tap tool hits any of those. If you are asking how to do the hit-test for annular wedge, then for each individual wedge, it is roughly:

  • is (x-x0)^2 + (y-y0)^2 > outer_radius**2 ? If so, not a hit
  • is (x-x0)^2 + (y-y0)^2 < inner_radius**2 ? If so, not a hit
  • is the “angle” (use atan to compute) between start_angle and end_angle ? If so, is a hit.

Thanks for the clear answer! I was hoping I didn’t have to math the answer, as I figured that data was readily available (as HoverTool would certainly use it).

It is available—but it’s all on the JavaScript side in the browser.