JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://mbostock.github.com/d3/talk/20111116/d3/d3.js"></script>
<script src="http://mbostock.github.com/d3/talk/20111116/d3/d3.layout.js"></script>

CSS

svg {
  font-size: 14px;
}

rect.background {
  fill: none;
  pointer-events: all;
}

.axis {
  shape-rendering: crispEdges;
}

.axis path, .axis line {
  fill: none;
  stroke: #000;
  stroke-width: .5px;
}

JavaScript

var m = [80, 160, 0, 160], // top right bottom left
    w = 1280 - m[1] - m[3], // width
    h = 800 - m[0] - m[2], // height
    x = d3.scale.log().range([0, w]),
    y = 25, // bar height
    z = d3.scale.ordinal().range(["steelblue", "#aaa"]); // bar color

var hierarchy = d3.layout.partition()
    .value(function(d) { return d.size; });

var xAxis = d3.svg.axis()
    .scale(x)
    .orient("top");

var svg = d3.select("body").append("svg:svg")
    .attr("width", w + m[1] + m[3])
    .attr("height", h + m[0] + m[2])
  .append("svg:g")
    .attr("transform", "translate(" + m[3] + "," + m[0] + ")");

svg.append("svg:rect")
    .attr("class", "background")
    .attr("width", w)
    .attr("height", h)
    .on("click", up);

svg.append("svg:g")
    .attr("class", "x axis");

svg.append("svg:g")
    .attr("class", "y axis")
  .append("svg:line")
    .attr("y1", "100%");

var root = getJson();
hierarchy.nodes(root);
x.domain([1, root.value]).nice();
down(root, 0);

function down(d, i) {
  if (!d.children || this.__transition__) return;
  var duration = d3.event && d3.event.altKey ? 7500 : 750,
      delay = duration / d.children.length;

  // Mark any currently-displayed bars as exiting.
  var exit = svg.selectAll(".enter").attr("class", "exit");

  // Entering nodes immediately obscure the clicked-on bar, so hide it.
  exit.selectAll("rect").filter(function(p) { return p === d; })
      .style("fill-opacity", 1e-6);

  // Enter the new bars for the clicked-on data.
  // Per above, entering bars are immediately visible.
  var enter = bar(d)
      .attr("transform", stack(i))
      .style("opacity", 1);

  // Have the text fade-in, even though the bars are visible.
  // Color the bars as parents; they will fade to children if appropriate.
  enter.select("text").style("fill-opacity", 1e-6);
  enter.select("rect").style("fill", z(true));

  // Update the x-scale domain.
  x.domain([1, d3.max(d.children, function(d) { return d.value; })]).nice();

  // Update the x-axis.
...