JSFiddle - React, Tailwind, and code Playground
HTML
<svg id="chart" class="chart" width=420 height=120 style="display: block;">
<rect y="0" width="40" height="20"></rect> <!--added to test-->
</svg>
JavaScript
$.fn.redraw = function(){
$(this).each(function(){
var redraw = this.offsetHeight;
});
};
var data = [4, 8, 15, 16, 23, 42];
var chart = jQuery("#chart");
jQuery.each(data, function(index, value) {
var bar = jQuery("<rect/>");
chart.append(bar);
bar.attr("y", index * 20)
.attr("width", value * 10)
.attr("height", 20);
});
chart.html(function(){return this.innerHTML});