JSFiddle - React, Tailwind, and code Playground

by yonet3d

HTML

<div class="chart"></div>

CSS

.chart div {
  font: 10px sans-serif;
  background-color: steelblue;
  text-align: right;
  padding: 3px;
  margin: 1px;
  color: white;
}

JavaScript

var data = [3, 7, 21, 31, 35, 42];

var width = window.innerWidth;
d3.select(".chart")//selecting the chart class. This is where the graph goes...
  .selectAll("div")
    .data(data)
  .enter().append("div")
    .style("width", function(data) { return data * 10 + "px"; })
    .text(function(data,i) { return i; });