O'Reilly logo

Expert Data Visualization by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Individual donut segments

In the previous section, you've seen that we call the updateCircle(show) function when the data is loaded, or when we selected something else in our dropdown. In this part, we'll look how, based on the selected item, we update or add new donut segments, and animate the changes. Let's start by collecting the data we want to show:

function updateCircle(toShow) {     // get the data for all the Firms     var filtered = loadedData.filter(filterData(toShow));     var totalFirms = filtered.reduce(function (total, el) {return total + +el.count}, 0);      // define the individual arc segments     var pie = d3.pie()         .sort(null)         .padAngle(0.04)         .value(function (d) {             return +d.count;         });   // create the arcs segments, the data property ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required