My variables are defined in an array like this:
const nbActions = 13;
const sdgValues = ['1', '2', '5', '6', '3', '0', '2', '0', '0', '6', '0', '0', '0', '1', '0', '0', '0'];
let sdg = [];
for (let i = 0; i < sdgValues.length; ++i) {
sdg[i] = (sdgValues[i] / nbActions * 100).toPrecision(4);
}
Now, I aim to show these values on dataSDGs using a loop without defining each sdg[x] individually:
const dataSDGs = {
data: [
sdg['0'],
sdg['1'],
sdg['2'],
sdg['3'],
...
]
}
The objective is to utilize these values to create a chart using chart.js