New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
d3.event is null in a ReactJS + d3JS component #6641
Comments
The code you reference appears to be general d3 javascript, and the event does not pass through React's event system. This looks like a d3 question, unrelated to React. For this reason, I'm going to close out this issue. On another note, you should use a |
Others with this issue will surely end up here, so here's an approach that worked for me:
If the result is |
It's very likely that you're using Babel, which has trouble importing a mutable field from d3 using the import / export syntax. See this: d3/d3#2733 (comment) You'll want to change the way you import d3 with the following: import * as d3 from 'd3';
import {event as currentEvent} from 'd3'; And replace all occurences of This fixes the issue with d3.js v3. |
Hi @jbmusso.
Do you have any solution? |
I am working on a bursh-able parallel coordinates graph with d3 v6 in react. I have the exact same issue: |
okay. 1 minute later I appear to have found an answer: like written in this article |
Hello i faced the same problem after using
I'm working with react v16 and d3 v7 and i'm using
Any help please ? |
Hola comunidad! |
I'm using ReactJS, d3JS and ES6 to create an org chart. I can create the chart and see it. But I want to add the zoom and drag behavior to the chart, so I used d3.behavior.zoom. I can see the method zoomed is called, but the d3.event is null.
I tried attaching the zoom behavior to the div, svg and g but nothing helps. The zoomed behavior is called but the event is null.
In my ASP.NET project I made sure that I don't have any reference to d3.js other than in the systemJS configuration which many stackoverflow answers mentioned as the issue related to why d3.event is null.
My code is very similar to what is in an example like this https://github.com/Swizec/candidate-bucket-chart/blob/169779e110c8825f4545c71ae5845ff7bad4f1f4/src/BubbleChart.jsx which uses the old version of ReactJS.
This is my systemJS configuration:
The text was updated successfully, but these errors were encountered: