I have the following array of objects which every objects I want to sort based on below mentioned logic. I want to sort every object and use it for data visualisations.
data=[
{
"Network":[78,89,22,89,24,20,92,72],
"Usage":[45,3,87,32,87,56,83,65],
"Congestion":[90,83,26,42,39,68,71,52]
},
{
"Network":[73,69,34,65,24,95,75,42],
"Usage":[42,76,94,34,65,24,84,24],
"Congestion":[42,53,22,86,22,13,48,56]
},
{
"Network":[73,77,93,28,90,13,42,9],
"Usage":[16,63,11,85,24,58,52,22],
"Congestion":[95,25,22,24,63,22,53,22]
}]
Now I assign kpi=data[0] and run the following for loop,
for(q in kpi)
{
r=0;
for(p in kpi[q])
{
if(kpi[q][p]<70)r++;
}
kpi[q].red=r;
}
So I now want to sort the kpi on the basis of value of red. How to do it? Likewise I want to sort every obeject and use it for visualisation using D3 js. So any help using D3 js will be very worthy. Thanks in advance.