Box() - set boundary on the Y axis

Hi all,

Very new to processing, essentially im trying to loop through a csv folder to create a bar graph. the bars will be 3d boxes. Using the below as an example, what i dont understand is, when using the box function, i want one end of the box to be stable, then vary along one direction (either go up or down -NOT both) depending on the value of y (from the below - the first box y = 20, the second y = 100 and third y = 150). It seems as i vary the y value, the relative boxe moves both up and down, instead im trying to get one end fixed at the value of the line and just get the other end to vary.

thanks in advance and sorry if this is a very basic question.

size(500,500,P3D);

pushMatrix();
translate(180, 200, 50);
box (10, 20, 30);
popMatrix();

pushMatrix();
translate(150, 200, 50);
box (10, 100, 30);
popMatrix();

pushMatrix();
translate(130, 200, 50);
fill(250);
box (10, 150, 30);
popMatrix();

line(0, 200, 200, 200);

The problem is that the box()es are drawn centered on the point you are translating to. To make their bases all line up, you need to translate them upward an amount that is half the height.

Consider:

size(500,500,P3D);

pushMatrix();
translate(180, 200, 50);
translate(0,-10,0);
box (10, 20, 30);
popMatrix();

pushMatrix();
translate(150, 200, 50);
translate(0,-50,0);
box (10, 100, 30);
popMatrix();

pushMatrix();
translate(130, 200, 50);
fill(250);
translate(0,-75,0);
box (10, 150, 30);
popMatrix();

line(0, 200, 200, 200);

thanks mate - works perfectly.