Skip to content
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

Update to d3 4 #141

Closed
andredumas opened this issue Aug 22, 2016 · 11 comments
Closed

Update to d3 4 #141

andredumas opened this issue Aug 22, 2016 · 11 comments

Comments

@andredumas
Copy link
Owner

andredumas commented Aug 22, 2016

Update dependency to d3 v4.

Potentially Breaking Changes

Changes were required to support this update:

  • axisannotations cannot auto orient themselves as d3.axis no longer exposes axis.orient(). A member has been added so that axisannotation.orient exists with the same interface as d3.v3 d3.svg.axis. Defaults to bottom. Pass strings top, bottom, left, right. This may change in future. If either d3 exposes orient, or constructors may be added similar to new axis constructors: axisannotationTop
  • financetime.zoomable() returns a persistent instance associated with the financetime. Previously was a new instance per call. To emulate previous functionality call financetime.zoomable().copy()
@aim4u
Copy link

aim4u commented Aug 22, 2016

If change d3 v3 into v4 on techan.js v0.6.0, it happen 'the uncaught TypeError'.

Cannot read property 'linear' of undefined
Cannot read property 'format' of undefined

@andredumas andredumas mentioned this issue Aug 22, 2016
3 tasks
@gajus
Copy link

gajus commented Aug 26, 2016

@andredumas is there a timeline for this?

@andredumas
Copy link
Owner Author

@gajus I haven't looked at what the impact will be, there's a few fundamental 'must have' features I'm getting through first to help increase coverage and ensure this cutover will be smooth.

@Silviu-Marian
Copy link

Do you need help?

@andredumas
Copy link
Owner Author

Yes, @Silviu-Marian, a check list of items would be great!

Some code would be awesome 😃

@Silviu-Marian
Copy link

Ha. Alright then, I'm looking into it. :)

@albertosantini
Copy link

albertosantini commented Sep 24, 2016

I report a minimal analysis about update task.

After following Build From Source steps and checking the tests are passed, I changed bower.json and package.json: from 3.5.17 to 4.2.6.

Main files and apis involved:

  • src\indicator\index.js (only d3.max)
  • src\plot\index.js (massive changes)
  • src\scale\financetime.js (Time intervals)
  • src\scale\index.js (Scales)
  • svg\index.js (only d3.functor)
  • src\util\index.js (for d3.rebind)

Check also test folder.

See Changes in D3 4.0 for details.

A brief resumen.

  • d3.scale.linear to d3.scaleLinear
  • d3.time.format("%c").parse to d3.timeParse("%c")
  • d3.svg.line to d3.line
  • d3.svg.area to d3.area
  • d3.behavior.drag to d3.drag
  • In place of d3.svg.axis and axis.orient, D3 4.0 now provides four constructors for each orientation: d3.axisTop, d3.axisRight, d3.axisBottom, d3.axisLeft.
  • The d3.functor method has been removed. If you want to promote a constant value to a function, the recommended pattern is to implement a closure that returns the constant value.
  • The method signature for optional accessors has been changed to be more consistent with array methods such as array.forEach: the accessor is passed the current element (d), the index (i), and the array (data), with this as undefined. This affects d3.min, d3.max, d3.extent, d3.sum, d3.mean, d3.median, d3.quantile, d3.variance and d3.deviation.
  • d3.bisect?
  • d3.mouse?

Really I didn't apply any change locally.

I would like to understand if we may create an approach with incremental steps.
Maybe we may distribute the workload between the contributors and the main dev, speeding up this issue.

As we know, as Argo developer, I am interested to close this issue. :)

@andredumas
Copy link
Owner Author

This is awesome thanks @albertosantini!

In terms of approach, I'll roughly spike it using your summary to size things up. If it feels large I'll add tasks here or create additional issues and push work to a branch. If any others want to contribute that would be great. Would certainly speed things up.

@andredumas andredumas added this to the 0.8.0 milestone Sep 27, 2016
@andredumas
Copy link
Owner Author

Actually made surprisingly good progress on this. Thanks again @albertosantini for the detailed summary. Definitely gave this task the kick start it needed.

All examples have been cut over as well.

Hopefully not too many issues coming out of this, extensive tests were definitely the hero of the day for this change.

@albertosantini
Copy link

@andredumas Thanks a lot for the effort.

I vote that commit as Commit of The Year. :)

Tested with Argo and it seems it works nice.

Thanks again!

@albertosantini
Copy link

This is how techan 0.8.0 (d3 V4) landed on my project:
albertosantini/argo@0b26eab
albertosantini/argo@c1e5b71

Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants