block by 1wheel 1e86c34932980874eb5f

1e86c34932980874eb5f

Full Screen

Answering Preventing d3 chords from overlapping on stackoverflow.

Modified from http://projects.delimited.io/experiments/chord-diagrams/coffee-from-files.html

I would not recommend actually using this solution:

//all the values in matrix are integers
//we can track the numbers that are starbucks stores
//by adding a small decimal to them
matrix = matrix.map(function(row){
  return row.map(function(d, i){
    return d + (i == row.length - 1 ? 1e-7 : 0) })
})

//now we can do a lexicographic sort 
//first checking for the presence of a decimal and then size
var chord = d3.layout.chord()
    .sortSubgroups(function(a, b){
      if (a != Math.round(a)) return false
      if (b != Math.round(b)) return true
      return b < a ? -1 : b > a ? 1 : 0;
    })

Modifying d3.layout.chord or starting fresh with something simpler that doesn’t require a redundant matrix of values would probably work better in most situations.

index.html

coffee-map.json

coffee-matrix.json

mapper.js

queue.js