react-d3-components icon indicating copy to clipboard operation
react-d3-components copied to clipboard

Not able to build with require js

Open mycodebucket opened this issue 9 years ago • 8 comments

could you please tell me, how to use this library with require js.

mycodebucket avatar Aug 29 '16 08:08 mycodebucket

I am getting the error " Cannot read property 'scale' of undefined" in "react-d3-components.js". i am not using webpack build.

mycodebucket avatar Aug 29 '16 12:08 mycodebucket

Could you post some sample of your code? The data you pass to the graph that makes it fail would be helpful :)

codesuki avatar Aug 29 '16 23:08 codesuki

Directory structure -Css -Fonts -Images -Js

(1) In js/index.html Here I have included d3.js using

(2 )In JS folder I have saved react-d3-components library (3) In js/sample.js I have require react-d3-components using Var xyz = require (“react-d3-components”); (4) Now when running the app I am getting error Uncaught TypeError: Cannot read property 'scale' of undefined. so the issue is app is not loading in the browser.

mycodebucket avatar Aug 30 '16 05:08 mycodebucket

This error mostly happens if the data you pass to the graph is bad or cannot be handled by the default scales. Since the code itself seems to be running I don't think it's a problem with requirejs. I could be wrong but.. could you provide a sample of the data you pass to the graph?

codesuki avatar Aug 30 '16 05:08 codesuki

demo

mycodebucket avatar Aug 30 '16 06:08 mycodebucket

when building the code i got the error "Cannot read property 'scale' of undefined". so issue is in the loading "react-d3-components" library. it is not loading in the browser. so i think it fails on the first step before going to pass the data to the charts and all that..

mycodebucket avatar Aug 30 '16 06:08 mycodebucket

Thanks for the sample. I will learn a little about requirejs when I find some free minutes. Haven't used it yet.

codesuki avatar Aug 30 '16 07:08 codesuki

okay , please go through it, when you get some free time.

mycodebucket avatar Aug 30 '16 18:08 mycodebucket