react-d3 / react-d3-basic

Basic d3 charts in React.js, only include: line, bar, pie, scatter, area charts.
http://reactd3.org/docs/basic
221 stars 117 forks source link

Unable to use LineChart #56

Open klvenky opened 6 years ago

klvenky commented 6 years ago

the error says Cannot read property 'string' of undefined. cannot read property string of undefined However I am passing a string as id to the chart component already. Same is the case for PieChart as well code screen

Looks like the entire library has a bug. Please help. I'm struck for almost 2 days

andershagebakken commented 6 years ago

I am also getting this. Following.

anupam96mondal commented 6 years ago

i am also getting the same issue in my project issue

klvenky commented 6 years ago

@anupam96mondal I don't know if I am right or not. Looks like this library is not actively maintained. You can probably look and find the root cause or try using some other library. I have used recharts. It also uses d3 and has nice customizations. I will try to see if I can find the root cause. Other wise find an alternative

jgiret commented 6 years ago

I'm getting the same issue using React 16.2 and the LineChart component => I'll try to find an alternative.

hmimyou commented 6 years ago

Seems this lib is using outdated react. The error is explained here: https://stackoverflow.com/questions/44573199/cannot-read-property-string-of-undefined-react-proptypes-layoutproptypes-j

namnm commented 6 years ago

Anyone comes up with a fork?

ashwinkjoseph commented 6 years ago

I have the same issue in my code, I had the same issue with react-sparklines so I tried this library. The issue as stated in this StackOverflow question is that the PropTypes is deprecated in the new release of React, However, I installed propt-types seperately but I dont know how to use it to solve this issue

klvenky commented 6 years ago

@ashwinkjoseph I think for fixing the issue, the library needs to be updated with the usage of latest prop-types module instead of pulling it from react instead. So I am not sure if this could be solved as easily. Let me try to fork once and check if I can make it work. Fingers crossed though

ashwinkjoseph commented 6 years ago

I just did exactly what you described as the solution. I did import the latest prop-types library and removed its dependencies on prop types from react.

Thanks and Regards Joseph Ashwin Kottapurath ashwinkjoseph@gmail.com +91-9745511318

On Thu, Jun 7, 2018, 12:46 PM Leela Venkatesh K notifications@github.com wrote:

@ashwinkjoseph https://github.com/ashwinkjoseph I think for fixing the issue, the library needs to be updated with the usage of latest prop-types module instead of pulling it from react instead. So I am not sure if this could be solved as easily. Let me try to fork once and check if I can make it work. Fingers crossed though

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/react-d3/react-d3-basic/issues/56#issuecomment-395318176, or mute the thread https://github.com/notifications/unsubscribe-auth/AND4FhcNyJLwNcbCaKUo1xN0pmZGEbqTks5t6NM-gaJpZM4Q-hAP .

raullarosa commented 6 years ago

@klvenky Thank you for that suggestion! I will try and make this my first PR.

ggsklias commented 6 years ago

I am a bit new to react and I am experiencing this issue. Can you please explain in a bit more detail which files need to be updated to prop-types?

raullarosa commented 6 years ago

@ggsklias

  1. Navigate to the react-d3-basic node modules folder in your terminal
  2. npm install prop-types
  3. To cover all your bases, go through each file in the module folder and search for ".PropTypes"
  4. Include var PropTypes = require('prop-types') at the top of each file that has a reference to PropTypes
  5. Remove the react library reference before each ".PropTypes" (normally "_react.PropTypes") to reference "PropTypes" directly.

If you "recompile" your app, the error log should guide you to which files your app is using so you don't have to go through each file. But if you want to cover all your bases so you don't encounter this issue later on, I recommend checking each file.