Adjust the position of the pie

master
Matt Huntington 9 years ago
parent b565f782d0
commit fe8d217002

@ -118,7 +118,7 @@ Fortunately, D3 can generate something like this for us:
```javascript ```javascript
var arc = d3.arc() var arc = d3.arc()
.innerRadius(100) .innerRadius(0) //to make this a donut graph, adjust this value
.outerRadius(radius); .outerRadius(radius);
``` ```
@ -179,3 +179,12 @@ var path = d3.select('g').selectAll('path')
return colorScale(d.data.label); //use .data property to access original data return colorScale(d.data.label); //use .data property to access original data
}); });
``` ```
## Adjust the position of the pie
The pie starts at (0,0), so we can move the group containing the pie:
```javascript
var container = d3.select('g')
.attr('transform', 'translate(' + (WIDTH / 2) + ',' + (HEIGHT / 2) + ')'); //pie center is at 0,0
```

Loading…
Cancel
Save