Hi all - with the much appreciated help from TfGuy44, i managed to develop the below. which is great and very useful. I have decided however to go in a slightly different direction and want to view my data in the form of a terrain. there would be essentially 5 red coloured lines and 5 blue coloured lines. with a white line running down the middle. the lines would be going from right to left (new data points appearing at the right hand side - this may be a good place to start) and the visualisation would be rotated slightly on the x axis. Viewing this way i think will give it greater context.
Thanks in advance for any help.
Jared
color[] colors = {
color(0, 0, 255, 200),
color(255, 0, 0, 200),
color(255, 255, 255, 200),
color(255, 255, 255, 0)
};
int[] bases = {
35,
35,
30,
50
};
class SingleBar {
float px, py, pz;
float sx, sy, sz;
color c;
SingleBar(float ipx, float ipy, float ipz, float h, int type) {
px = ipx;
py = ipy;
pz = ipz;
sx = sz = bases[type];
sy = h;
c = colors[type];
}
void draw() {
strokeWeight(1);
pushMatrix();
noStroke();
translate(px, py, pz);
translate(0, -sy/2, 0);
fill(c);
box(sx, sy, sz);
popMatrix();
}
}
ArrayList<SingleBar> sbs = new ArrayList();
float a =0;
int b = 1;
int offset = 0;
final int OFFSET_SPEED = 6;
final int MAX_BARS = 300;
float atX = 0;
float atZ = 0;
boolean toggleLoop = true;
void setup() {
size(1000, 2000, P3D);
noStroke();
}
void draw() {
background(0);
translate(width/2, height/2);
lights();
rotateY(-map(mouseX, 0, width, -HALF_PI, HALF_PI));
rotateX(map(mouseY, 0, height, -PI, PI));
translate(0, 0, atZ-offset);
for ( int i = 0; i< sbs.size(); i++) {
sbs.get(i).draw();
}
if ( offset > 60 ) {
atZ -= 60;
offset %= 60;
for ( int i = 0; i < 9; i++) {
sbs.add( 0, new SingleBar(60*i+140, height/3, -atZ, random(60, 300), 0) );
sbs.add( 0, new SingleBar(-60*i-140, height/3, -atZ, random(60, 300), 1) );
}
sbs.add( 0, new SingleBar(0, height/3, -atZ, random(0, 75), 2) );
}
println(offset);
offset+=OFFSET_SPEED;
a = a+.05;
b=b+1;
if (-175+a > -125){
a = 0;
}
}
void mousePressed() {
if (mouseButton == LEFT) {
if (toggleLoop) { noLoop(); toggleLoop = false; }
else { loop(); toggleLoop = true; }
} }