


#D3 mouse coordinates code#
The less code you post, the easier it is for someone to debug, and the more likely you are to get a helpful response. Reply to this email directly or view it on GitHub: 90 (comment) Jan Willem Tulp. This will return an array x, y that is local to the element, using SVGLocatable getScreenCTM. Isolate the issue and reduce your code as much as possible before asking for help. You should use d3.svg.mouse (element), where element is the transformed. It is often impossible to debug from code snippets alone. When asking for help, please include a link to a live example that demonstrates the issue, preferably on ( ). Stack Overflow provides a better collaborative forum for self-help: tens of thousands of D3-related questions have already been asked there, and some answered questions may be relevant to you. Although I make an effort to assist everyone that asks, I am not always available to provide help promptly or directly. More generally, please use Stack Overflow tag d3.js to ask for help.

If zooming isn’t working for you, perhaps you’re not retaining an untransformed copy of the scale for use with transform.rescaleX? See #2935 for a related discussion and see the Pan & Zoom Axes example. Yes, the zoom.x feature from v3 was replaced by transform.rescaleX in v4. Tip: To get the vertical coordinate (according to the client area) of the mouse pointer, use the clientY property. Sorry, but I’m not sure what you are asking. The clientX property returns the horizontal coordinate (according to the client area) of the mouse pointer when a mouse event was triggered.
