Coder Social home page Coder Social logo

d3.join? about d3-array HOT 6 OPEN

d3 avatar d3 commented on May 1, 2024 2
d3.join?

from d3-array.

Comments (6)

Firescar96 avatar Firescar96 commented on May 1, 2024 1

https://github.com/Firescar96/d3-array/tree/master/src/join
https://github.com/Firescar96/d3-array/blob/master/test/join-test.js

I haven't written docs for it yet, but the tests should be helpful for how it works til I do. I went with the cartesian product via nested loop join as the default. There's also a sort merge join option, or a person can write their own.

from d3-array.

Fil avatar Fil commented on May 1, 2024 1

My feeling after reading this several times over the last month is that it appears too complex (for me) to memorize the arguments and the way this would work. I'd fear not really seeing what's happening, and I'd personally rather create an index first for the key then join "manually". Detailed examples using ES6 and d3.group, d3.rollup or d3.index (#136) would suit me better than the "magic" of d3.join. Also a risk of (mental) collision with selection.join.

from d3-array.

timelyportfolio avatar timelyportfolio commented on May 1, 2024

Just in case it helps think through, here is lodash-joins. From the R side, dplyr joins.

from d3-array.

Firescar96 avatar Firescar96 commented on May 1, 2024

sure I'll give it a try, going to use sorted merge joins for functionality like

d3.join()
    .key(d => d.id)
    .reduce((a, b) => a.properties.rate = +b.rate)
    (dataset1, dataset2)

I'm not sure what you meant @mbostock by the case join.key with no arguments.

EDIT: Ah, after looking at other d3 modules as a guide for how to implement this I see what you mean, I'll use this syntax instead:

let joinOp = d3.join(dataset1, dataset2)
    .key(d => d.id)
    .reduce((a, b) => a.properties.rate = +b.rate)

console.log(joinOp.apply())

from d3-array.

Firescar96 avatar Firescar96 commented on May 1, 2024

Benchmarks against lodash-joins, using their tests
screenshot-20171206-16 54 01

from d3-array.

curran avatar curran commented on May 1, 2024

Would we ever want async join? Each record, for example, making an API request?

from d3-array.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.