First define the margin
object with properties for the four sides (clockwise from the top, as in CSS).
var margin = {top: 20, right: 10, bottom: 20, left: 10};
Then define width
and height
as the inner dimensions of the chart area.
var width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
Lastly, define svg
as a G element that translates the origin to the top-left corner of the chart area.