-
-
Save anonymous/4021391 to your computer and use it in GitHub Desktop.
just another inlet to tributary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"endpoint":"","display":"svg","public":true,"require":[],"tab":"edit","display_percent":0.5141263940520446,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chart_group = d3.select("svg"); | |
var width = parseFloat(chart_group.attr("width")); | |
var height = parseFloat(chart_group.attr("height")); | |
var outerRadius = Math.min(width, height) / 3, | |
innerRadius = outerRadius * 0.6, | |
data = d3.range(5).reverse(), | |
color = d3.scale.category20(), | |
donut = d3.layout.pie(), | |
arc = d3.svg.arc() | |
.innerRadius(innerRadius) | |
.outerRadius(outerRadius) | |
.startAngle(-90 * (Math.PI /180 )) | |
.endAngle(10 * (Math.PI /180 )) | |
; | |
var sum = 10; | |
var scale = d3.scale.linear().domain([1, sum]).range([0 * (Math.PI /180 ),360 * (Math.PI /180 )]); | |
var arcs = chart_group.selectAll("g.arc") | |
.data(data) | |
.enter() | |
.append("svg:g") | |
.attr("transform", "translate(" + outerRadius + "," + outerRadius + ")"); | |
var currentAngle = 0; | |
console.log("LOG:","arc()",arc(),data,sum); | |
arcs.append("svg:path") | |
.attr("fill", function(d, i) { return color(i); }) | |
.attr("d", function(d,i) { | |
var angle = scale(d); | |
console.log("LOG:","scale(d)",scale(d),d); | |
//arc. | |
arc | |
.startAngle(currentAngle/2) | |
.endAngle((currentAngle+angle)/2) | |
currentAngle += angle; | |
return arc(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment