Table of Contents

About

The svg module provides various shapes suitable for charting.

Example

The arc function, builds elliptical arcs as for pie and donut charts by mapping arbitrary data to paths; typically this function is bound to the “d” attribute of SVG path elements Note that the radii and angles of the arcs can be specified either as constants or as functions—in the latter case, the functions are evaluated per element with access to data—identical to D3’s core operators.

d3.select("body").append("svg:svg")
     .data([[1, 1.2, 1.7, 1.5, .7]])
     .attr("width", 150)
     .attr("height", 150)
   .selectAll("path")
     .data(d3.layout.pie())
   .enter().append("svg:path")
     .attr("transform", "translate(75,75)")
     .attr("d", d3.svg.arc().outerRadius(70));