JSFiddle - React, Tailwind, and code Playground
HTML
<div id="#companies-container" class="container" style="height: 100vh">
</div>
<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
JavaScript
var prices = [{
"pagination": {
"count": 6,
},
"data": [
{
"open": 9.67,
"close": 9.98,
"volume": 17876279,
"symbol": "WISH",
"date": "2021-08-05T00:00:00+0000"
},
{
"open": 10.3,
"close": 9.61,
"volume": 34099145,
"symbol": "WISH",
"date": "2021-08-04T00:00:00+0000"
},
{
"open": 10.36,
"close": 10.31,
"volume": 20379283,
"symbol": "WISH",
"date": "2021-08-03T00:00:00+0000"
}
]
},
{
"pagination": {
"count": 6,
},
"data": [
{
"open": 27.3,
"close": 28.33,
"volume": 2360664,
"symbol": "CRSR",
"date": "2021-08-05T00:00:00+0000"
},
{
"open": 26.83,
"close": 27.4,
"volume": 4409156,
"symbol": "CRSR",
"date": "2021-08-04T00:00:00+0000"
},
{
"open": 26.99,
"close": 27.13,
"volume": 8675462,
"symbol": "CRSR",
"date": "2021-08-03T00:00:00+0000"
}
]
}];
const margin = {left:20, right: 20, top:20, bottom:20}, width = 400, height = 200;
const div = d3.select(".container");
prices.map(symbol=>{
const {data, pagination} = symbol;
console.log(data);
const companyContainer = div.append("div").attr("class","company-container");
const companyProfile = companyContainer.append("div").attr("class", "company-profile");
const companyRecommend = companyContainer.append("div").attr("class", "company-container");
const companyPrice = companyContainer.append("div").attr("class","company-price");
const svg =...