Plot[] plots; Canvas canvas01; Debug debug01; Axis axis01; Line[] lines; // Initializes width, height, and chart zero points int w; int h; float xz; float yz; /* ----------------------------------------- */ float xmax; // max horizontal edge of the chart float ymax; // max vertical edge of the chart int markerArm = 3; int markerSpace = 20; // % of values to maximum value present in list, multiplied by chart dimension (xmax - xz) int maxXValue = 690; int maxYValue = 400; // Innitialize color values color bg; color colorG; color colorB1; color colorB2; color colorR1; color colorR2; float blah1; float blah2; void setup() { size(648,400); frameRate(60); smooth(); noCursor(); w = width; h = height; xz = ((w - w) + 20); // x-zero point yz = h - 20; // y-zero point xmax = w - 120; ymax = ((h - h) + 20); // Assign Color Values bg = color(72,72,94,70); colorG = color(183,234,95); colorB1 = color(234,116,233,50); colorB2 = color(234,116,233); colorR1 = color(95,219,234,50); colorR2 = color(95,219,234); // Define Objects canvas01 = new Canvas(); debug01 = new Debug(); axis01 = new Axis(); // Assign Font PFont font = loadFont("CourierNewPSMT-11.vlw"); textFont(font,11); // Innitalize Data String, and assign length to new Plot/Line instances String[] data = loadStrings("data.txt"); plots = new Plot[data.length]; lines = new Line[data.length]; for (int i = 0; i < plots.length; i++) { float[] values = float(split(data[i],",")); // Split Data from txt file values[0] = (xz + ((values[0] / maxXValue) * (xmax - xz))); // xz shift, % baseline, -margin values[1] = (yz - ((values[1] / maxYValue) * (yz - xz))); // yz inverts, % baseline, -margin plots[i] = new Plot(values[0],values[1]); // assign values as arguements if (i > 0) { lines[i] = new Line(blah1,blah2,values[0],values[1]); } else { lines[i] = new Line(0,0,0,0); } blah1 = values[0]; blah2 = values[1]; } } void draw() { background(38,47,69); canvas01.display(); debug01.display(); axis01.display(); for (int i = 0; i < plots.length; i++) { plots[i].display(); plots[i].rollover(mouseX,mouseY); lines[i].display(); } // Mouse Crosshair fill(255,60); stroke(255,60); strokeWeight(1); line(mouseX,0,mouseX,height); line(0,mouseY,width,mouseY); rectMode(CENTER); rect(mouseX,mouseY,2,2); rectMode(CORNER); fill(38,47,69); noStroke(); rect(0,0,2,2); }