plottable

How can I determine if the right mouse button was clicked in a Plottable chart?


The Plottable Click Interaction doesn't pass the callback any sort of event (synthetic or otherwise) so I can't figure out a way to determine which button was clicked.

Has anyone wired up the right mouse button to a Plottable chart?


Solution

  • The solution I ended up implementing is a bit of a hack, but since I don't have access to the click event, I decided to use a combination of a native event and a Plottable Interaction.

    Using a native event listener I register an onClick on the entire svg and use the passed in event to determine which button was clicked. That's only half the solution though, since I no longer have the point (x/y coord) of where on the dataPane was clicked. To get that I registered a callback with Plottable's Interaction.Pointer.onPointerMove() in effect recording the mouse position perpetually by setting a global variable, so my click callback has access to the Point, and I can determine what on the chart was clicked.