Skip to main content
100%

D3 Example

✓ Published0🌍 Public
CCurran Kelleher
Last edited Nov 21, 2015
Created on Nov 21, 2015

This example demonstrates how D3’s pie layout transforms tabular CSV data into pie-slice geometry by attaching computed `startAngle` and `endAngle` properties to each data point. The visualization reads `religionWorldTotals.csv`, which contains population figures for world religions, and configures the pie layout to use the `population` column as the slice-sizing value. The code uses `d3.layout.pie()` and `pie.value()` to define the angle mapping, then renders the resulting array as formatted JSON into a `<pre>` element for inspection. It relies on the D3 library (version 3.5.5) loaded from a CDN, and the data is parsed with a custom `type` function that coerces numeric strings.

AI-generated description

This is a small code example that shows what d3.layout.pie(). It adds properties including "startAngle", "endAngle" for the slices of a pie chart. This is example 24 from the screencast Splitting Charts.

MIT License

<!-- Start of SimpleHitCounter Code --> <div align="center"><a href="http://www.simplehitcounter.com" target="_blank"><img src="http://simplehitcounter.com/hit.php?uid=1979675&f=16777215&b=0" border="0" height="18" width="83" alt="web counter"></a></div> <!-- End of SimpleHitCounter Code -->

Similar vizzes