Adjusting the position of the pie

Currently, we can only see the lower-right quarter of the pie graph. This is because the pie starts at (0,0), but we can move the group element containing the pie by adjusting our d3.select('svg') code, as follows:

d3.select('svg')
.attr('width', WIDTH)
.attr('height', HEIGHT);
var container = d3.select('g') //add this line and the next:
.attr('transform', 'translate(' + (WIDTH / 2) + ',' + (HEIGHT / 2) + ')'); //add this line

The pie graph now looks as follows:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.117.192