AnSavvides / d3act

d3 with React
MIT License
298 stars 26 forks source link

Upgrade to d3 4.x #24

Closed jfsiii closed 8 years ago

jfsiii commented 8 years ago

As of v4, d3 has been broken up into many modules (e.g. d3-scale, d3-selection, etc). There are also some API changes.

Not only is it a good idea to stay on the current major version, but the final size would drop quite a bit if d3act only imports the d3 packages it needs.

I've ported a few examples and projects from 3.x to 4.x and it's relatively simple. Changing import d3 from "d3" to import * as d3 from 'd3' then doing a search-and-replace for the new methods names (old: d3.scale.ordinal new: d3.scaleOrdinal, etc) will get you pretty far. Converting to statements like import { scaleLinear, scaleOrdinal } from 'd3-scale' should be the ultimate goal, but I typically save that for a second pass after things are converted and working.

The changes to selections are probably the most substantial but, in my experience, don't take much effort to convert.

AnSavvides commented 8 years ago

Thanks for this @jfsiii, really appreciate you taking the time!

If you've got time, would you like to have a go at these changes yourself? If not, I'll try find time myself and work on this whenever I get a chance :)

davidkui commented 8 years ago

I have a question. Does this version support the Tree graph? thanks

AnSavvides commented 8 years ago

I can't tell you off the top of my head, but do have a look at the d3 releases - d3act currently uses v3.5.5 of d3 :)

cdotta commented 8 years ago

I created a pull request to fit this issue

AnSavvides commented 8 years ago

Done as part of #26 - thanks @cdotta for working on this! 😄