d3fc-webgl-hathi-explorer
d3fc-webgl-hathi-explorer copied to clipboard
How to add onClick event to each point
Hello, I'm trying to add an "onClick" event to each point, but cannot find any documentation on how to do so. The latest version of d3fc is 15.2 but I can only found docs on v. 13. Can you please help? Thank you!
You get click events with DOM (or SVG nodes), however, they don't exist for Canvas or WebGL. This plot uses WebGL, so hence they are not triggered!
You'll have to 'synthesise' this event yourself, by monitoring mouse location and clicks - see:
https://github.com/ColinEberhardt/d3fc-webgl-hathi-explorer/blob/master/index.js#L117
OK thank you Colin, I knew this technique for Canvas but not for WebGL.