JSFiddle - React, Tailwind, and code Playground

HTML

<form>
  <label><input type="radio" name="mode" value="size"> Size</label>
  <label><input type="radio" name="mode" value="count" checked> Count</label>
</form>

CSS

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  margin: auto;
  position: relative;
  width: 700px;
}

form {
  position: absolute;
  right: 10px;
  top: 10px;
}

path {
  stroke: #fff;
  fill-rule: evenodd;
}

JavaScript

var width = 960,
    height = 700,
    radius = Math.min(width, height) / 2;

var x = d3.scale.linear()
    .range([0, 2 * Math.PI]);

var y = d3.scale.sqrt()
    .range([0, radius]);

var color = d3.scale.category20c();

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height)
  .append("g")
    .attr("transform", "translate(" + width / 2 + "," + (height / 2 + 10) + ")");

var partition = d3.layout.partition()
    .sort(null)
    .value(function(d) { return 1; });

var arc = d3.svg.arc()
    .startAngle(function(d) { return Math.max(0, Math.min(2 * Math.PI, x(d.x))); })
    .endAngle(function(d) { return Math.max(0, Math.min(2 * Math.PI, x(d.x + d.dx))); })
    .innerRadius(function(d) { return Math.max(0, y(d.y)); })
    .outerRadius(function(d) { return Math.max(0, y(d.y + d.dy)); });

// Keep track of the node that is currently being displayed as the root.
var node;

	var root = JSON.parse('{ "name": "flare", "children": [  {   "name": "analytics",   "children": [    {     "name": "cluster",     "children": [      {"name": "AgglomerativeCluster", "size": 3938},      {"name": "CommunityStructure", "size": 3812},      {"name": "HierarchicalCluster", "size": 6714},      {"name": "MergeEdge", "size": 743}     ]    },    {     "name": "graph",     "children": [      {"name": "BetweennessCentrality", "size": 3534},      {"name": "LinkDistance", "size": 5731},      {"name": "MaxFlowMinCut", "size": 7840},      {"name": "ShortestPaths", "size": 5914},      {"name": "SpanningTree", "size": 3416}     ]    },    {     "name": "optimization",     "children": [      {"name": "AspectRatioBanker", "size": 7074}     ]    }   ]  },  {   "name": "animate",   "children": [    {"name": "Easing", "size": 17010},    {"name": "FunctionSequence", "size": 5842},    {     "name": "interpolate",     "children": [      {"name": "ArrayInterpolator", "size": 1983},      {"name": "ColorInterpolator", "size": 2047},      {"name": "DateInterpolator",...