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 width = window.innerWidth;
var data = [3, 7, 21, 31, 35, 42];
var color = d3.scale.category10();
var x = d3.scale.linear()
.domain([0, d3.max(data)])//min and max of data that you want to show
.range([0, width]);//representation of it.
d3.select(".chart")
.selectAll("div")
.data(data)
.enter().append("div")
.style("width", function(d) { return x(d) + "px"; })
.style("background-color", function(d, i) { return color(i);})
.text(function(d) { return d; });