fetch("./json/TMA-1.json")
.then( response => { response.json()
.then( data => {
console.log(data);
if(data.length > 0) {
var cube = [];
to loop the cube so it will appear next to each other like a graph
data.forEach((u) => {
cube[u] = new THREE.BoxGeometry;
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00, wireframe: false } );
scene.add(cube[u]);
}
)}}
)
})
the code above needs to turn json array as a bar graph based on the numerical value fetched
[
{ "Car_Company": "ALFA ROMEO", "YR2018": 535, "YR2019": 456,
"YR2020": 444, "YR2021": 446
},
{ "Car_Company": "ASTON MARTIN",
"YR2018": 213, "YR2019": 218, "YR2020": 238, "YR2021": 263
}