First of all, I think that you should re-consider stuff in a more Object-Oriented programming way. I took the time to rewrite some of your code implementing an object for each record(field):
Code:float xPerc;
float yPerc;
int back;
int plaice;
int chartSize;
ArrayList fields = new ArrayList();
ArrayList activeFields = new ArrayList();
void setup(){
back = 400;
size(back,back);
background (200);
smooth();
importData();
}
void importData() {
String[] data = loadStrings("fakeDat.csv");
for (int i=0; i < data.length; i++){ //Start from zero, not one
String[] temp=split(data[i],",");
fields.add(new field(temp[0],float(temp[1]),float(temp[2])));
}
}
class field {
String name;
float x,y;
field(String namein,float xin,float yin) {
name=namein;
x=xin;
y=yin;
}
}
void draw(){
background (200);
noStroke();
plaice = 10;
chartSize = back-plaice*2;
fill(255);
rect(plaice, plaice, chartSize, chartSize);
stroke(200);
for (int i=0; i<=3; i++){
line(plaice+(i*(chartSize/4)), plaice, plaice+(i*(chartSize/4)), plaice+chartSize);
line(plaice, plaice+chartSize-(i*(chartSize/4)), plaice+chartSize, plaice+chartSize-(i*(chartSize/4)));
}
for (int i=0; i < fields.size(); i++){
field f=(field)fields.get(i);
float dotCol1 = map(f.x,0,1,0,255);
float dotCol2 = map(f.y,0,1,0,255);
fill(dotCol1, dotCol2, 200);
stroke(100);
ellipse(plaice+(f.x*chartSize),(plaice+chartSize)-(f.y*chartSize), 10, 10);
fill(0);
if(mouseX > plaice+(f.x*chartSize)-10 && mouseX < plaice+(f.x*chartSize)+10 && mouseY >
(plaice+chartSize)-(f.y*chartSize)-10 && mouseY < (plaice+chartSize)-(f.y*chartSize) +10)
{
text (f.name,(plaice+(f.x*chartSize))+10,(plaice+chartSize)-(f.y*chartSize));
}
}
}
I trust that this will help you in achieving the permanent label display. What you should do is check in the mousePressed() event if a point is under the cursor. If it is, copy it to the activePoints ArrayList. If it is in the activePoints already (check with ArrayList.contains(x)), then remove it (click-again behavior). Then just render the labels of the items present in this ArrayList, apart from anything else you normally render.