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

TypeError: (0 , _reactD3Basic.series) is not a function #34

Closed SPSpwetter closed 8 years ago

SPSpwetter commented 8 years ago

I'm running into an issue using react-d3-brush, that it can seem to find _reactD3Basic.series.

Others have run into this problem, on stackoverflow

My best guess from research so far is that this somehow relates to CommonJS exports? Something about babel? Thing is, I'm not using babel, and all the research so far is to disable babel for node_modules. CommonJS reference

Output below:

TypeError: (0 , _reactD3Basic.series) is not a function at LineBrush.render (webpack:///./~/react-d3-brush/lib/line.js:74:1)

SPSpwetter commented 8 years ago

Updated theory: I think this is actually just a problem with react-d3-brush, as my test using only react-d3-basic works fine. Perhaps react-d3-brush just needs to be updated?

SPSpwetter commented 8 years ago

Closing this as I figured out its because react-d3-brush is out of date with a refactoring that moved some things into react-d3-shape. Open new bug in react-d3-brush instead.

DonKanallie commented 8 years ago

Hey, I'm running into the same issue. How did you get it to work?

SPSpwetter commented 8 years ago

First, I didn't, I moved the issue over to react-d3-brush with more detail.

Second, we worked around it here temporarily by using the prebuilt js which includes the correct versions of core and basic prior to the refactor.

Third, upon reviewing the code, we decided we needed to build our own brush, as brush is a feature that should be available to layer over any graph. The existing implementation use d3 and a custom mini graph.

One of the things we've learned the hard way with D3 is that it has great demos, but those demos are much like regular expressions: D3 is math, you write it once. The great temptation with D3 is to continue to use it for interaction. The D3 demos imply this is the way to go but this turns out to be an anti pattern, you want to use react for the interaction, because what you really want is composable charts. That is, you want all of your charts to be brushable, and you want to manage what happen when the user brushes yourself.

So we're looking at making a brush layer that can be composed over any graph via React.