Skip to content

Instantly share code, notes, and snippets.

@erizhang
Created August 1, 2014 05:39
Show Gist options
  • Save erizhang/957b2d192b671274bca5 to your computer and use it in GitHub Desktop.
Save erizhang/957b2d192b671274bca5 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
body {margin: 0;}
circle {fill: orange; stroke: #333;}
path {fill: steelblue; stroke: #333; stroke-width: 4;}
</style>
</head>
<body>
<script>
var width = 960;
var height = 600;
var svg = d3.select('body').append('svg')
.attr("width", width)
.attr("height", height);
// our radial line generator
var lineRadial = d3.svg.line.radial();
var n = 1000, max_r = 250, rotations = 10;
var data = d3.range(n).map(function(d){
var t = d / (n - 1);
return [t * max_r, t * Math.PI * rotations * 2];
});
var link = svg.append('path').datum(data).attr('d', lineRadial)
.attr('transform', 'translate(300, 300)');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment