WIP: Recreating the D3 Chord Diagram with vega.js
Actually, the grammar does not provide any vega transform (layout/hierarchy transforms) to create chord diagrams, so data has been generated from d3 using d3.chord() to compute the chord layout and d3.ribbon() to generate the ribbons:
chord = d3.chord().padAngle(0.05).sortSubgroups(d3.descending)
ribbon = d3.ribbon().radius(innerRadius)
var chords = chord(data);
console.log(JSON.stringify(chords.groups));
console.log(
JSON.stringify(
chords.map(function(chord) { return {'path' : ribbon(chord)} ; })
)
);
feeding the data into the vega specifications, is relatively straighforward to generate the diagram.
Vega.js can be extended, so a new Data Transform could be implemented in order to do all the data transformation, so we can rely only on vega spec to create the diagram.