Skip to content

Instantly share code, notes, and snippets.

@NPashaP
Created January 13, 2018 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NPashaP/162933af741d8a42cf62dd13d0dcf060 to your computer and use it in GitHub Desktop.
Save NPashaP/162933af741d8a42cf62dd13d0dcf060 to your computer and use it in GitHub Desktop.
Viz - chord - redraw
license: gpl-3.0
<!DOCTYPE html>
<meta charset="utf-8">
<style>
</style>
<body>
<svg width="960" height="500">
<g transform="translate(450,250)"></g>
</svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="http://vizjs.org/viz.v1.3.0.min.js"></script>
<script>
var chord = viz.chord().data(getData())
setInterval(update, 2000)
function update(){
d3.select("g").call(chord.data(getData()));
}
function getData(){
var n = ["China", "US", "UK", "India", "Canada"];
var ret = [];
n.forEach(function(s){
n.forEach(function(t){
ret.push([s,t, Math.floor(Math.random()*1000)])
})
})
return ret;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment