Skip to content

Instantly share code, notes, and snippets.

@ejfox
Created October 26, 2012 18:42
Show Gist options
  • Select an option

  • Save ejfox/3960624 to your computer and use it in GitHub Desktop.

Select an option

Save ejfox/3960624 to your computer and use it in GitHub Desktop.
Make links for D3 force layout
_.each(d3darkmoney.nodes, (row, index) ->
# console.log "Nodes, ", row, index
if row.lean is "conservative" && row.type is "cluster"
d3darkmoney['links'].push({"source": index, "target": 0, "value": 1})
else if row.lean is "liberal" && row.type is "cluster"
d3darkmoney['links'].push({"source": index, "target": 1, "value": 1})
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment