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>
<svg id="chart2" class="chart" width=420 height=120 style="display: block;">
    
</svg>

JavaScript

$(document).ready(function() {
    var data = [4, 8, 15, 16, 23, 42];
    var chart = jQuery("#chart2");
    jQuery.each(data, function(index, value) {
        var bar = $(document.createElementNS("http://www.w3.org/2000/svg", "rect")).attr({
            x: 0,
            y: index * 20,
            width: value * 10,
            height: 20,
            stroke: "red",
            fill: "white"
        });
        chart.append(bar);
    });
});