score:0

in your example, d3.chord() computes the layout of the data. it's important to note that, in d3, "layout" has a different meaning of layout in data visualisation: here, layout has to do with preparing the data to create a given chart (not the visual "layout" of the chart).

basically, d3.chord() takes your data matrix and creates another data matrix with a bunch of starting angles and ending angles, associating sources to targets.

after d3.chord() modifies the data, they are passed to d3.ribbon(). d3.ribbon is the real path generator, creating the actual path that will be painted in the svg. how does it knows the data? you have previously bounded the modified data to your group:

.datum(chord(matrix));

that's the data passed to d3.ribbon().

according to the api, d3.ribbon()...

...generates a ribbon for the given arguments. the arguments are arbitrary; they are simply propagated to the ribbon generator’s accessor functions along with the this object [...] with the default settings, a chord object expected.


Related Query