A coordinate system gives SVG shapes a shared way to locate points. The SVG container’s origin is its top-left corner: x increases to the right, and y increases downward. That downward y direction is easy to forget when positioning shapes. section 1.2.2
Place a line
In `<line x1="50" y1="45" x2="140" y2="225" />`, the first endpoint is 50 units right and 45 down from the origin. The second is 140 right and 225 down. SVG shape attributes supply these positions. section 1.2.2
A chart often needs room around its plotted area for labels and legends. Rather than add the margins to every shape’s coordinates, place the chart elements in a group and translate that group by the left and top margins. The inner chart then has its own coordinate system. section 4.1.1
const innerChart = svg
.append("g")
.attr("transform", `translate(${margin.left}, ${margin.top})`);
The group’s `translate(${margin.left}, ${margin.top})` moves the inner chart’s coordinate system into its reserved area. section 4.1.1



