The second loop (for (int j = years[i].xrateValue.size ()-1; j >= 0; j--)) is retrieving all the xrate values for each Year from the array (years[i]). Please do you have any ideas of how I can only return the xrate values for each year in the array. For example, Year 1990 has Xrate 2,5,6,5.6 and Year 1991 has Xrate 3,6.7,5,8,1.4. The loop should only return the Xrate values for 1990 and then 1991 and so on.
for (int i=0; i<years.length; i++)
{
//code to display each year
for (int j = years[i].xrateValue.size ()-1; j >= 0; j--)
{
float xrate = (float)(years[i].xrateValue.get(j));
float barHeight = map(xrate, 0, mathMax, 0, 80); //adjust rect size
float bX = sX+2;
float bY = sY + 105 - barHeight;
float bW = 105 / years.length;
strokeWeight(0.9);
stroke(10);
fill(255, 8, 8);
if (xrate >= 71)
{
fill(2, 152, 48);
} else if ((xrate >= 51) && (xrate <= 70))
{
fill(255, 217, 19);
}
rect(i+i+i+bX, bY, bW, barHeight);
}
}