BufferedReader reader; String line; PGraphics pg; float x=0; float y1=0; float y2=0; String[] positions=new String[1000]; PFont font; void setup() { reader = createReader("data.txt"); size(755,256); frameRate(200); smooth(); font = loadFont("font.vlw"); textFont(font,14); pg=createGraphics(755, 256, P2D); pg.beginDraw(); pg.smooth(); pg.background(255); pg.stroke(0); boolean run=true; while(run){ try { line = reader.readLine(); } catch (IOException e) { e.printStackTrace(); line = null; } if (line == null) { // Nothing left in the file, stop reading. run=false; } else { String[] pieces = split(line, ' '); float a = float(pieces[1]); float b = float(pieces[2]); pg.line(x, 127-a/1024*128,x,128); pg.line(x, 255-b/1024*128,x,256); positions[int(x)]=pieces[0]+" "+str(round(a/1024*5*100)/100.0)+"V "+str(round(b/1024*5*1000))+"mA"; } x+=0.1; } pg.endDraw(); } void draw() { image(pg,0,0); fill(255,0,255); text(positions[mouseX], (mouseX+textWidth(positions[mouseX])