We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello all, I want to have 2 checkbox filters in my processing datavisualization. The checkboxes must filter the numbers (nr) from 1-7 (1checkbox) and numbers 8-13 (1 checkbox). The problem is: I have no clue how to do this. Is there anyone who can help me with this?
Table table;
String[] land={};
float[] bbp = {};
int[] nr = {};
float r = random(250);
void setup (){
table = loadTable("data.csv", "header");
for (TableRow row : table.rows()) {
land = append(land, row.getString("land"));
bbp = append(bbp, row.getFloat("bbp"));
nr = append(nr, row.getInt("nr"));
println(land.length);
}
size(2000,600);
background(240);
smooth();
stroke(50,50,50,50);
strokeWeight(2);
}
void draw (){
background(240);
line(0, height/2, width, height/2);
for(int i=0; i< nr.length;i++){
float c = nr[i]*12;
fill(250, c,c,200);
ellipse(nr[i]*110 -20 , height/2, bbp[i]*3, bbp[i]*3);
fill(30);
pushMatrix();
translate(nr[i]*110 -20, height/2 - bbp[i]/2);
rotate(radians(-45));
text(land[i],-50 ,50);
text(bbp[i],10,10);
textSize(18);
popMatrix();
text("BBP per land plaats 1t/m13",10 ,height/3);
text("Bron: https://nl.wikipedia.org/wiki/Lijst_van_landen_naar_bbp_per_hoofd_van_de_bevolking", height/2, width/4);
smooth();
}
}
Data (csv): land,bbp,nr
Luxemburg,104.5,13 Noorwegen,79.1,12 Qatar,68.9,11 Zwitserland,67.6,10 Denemarken,56.1,9 Ierland,51.4,8 Nederland,48.2,7 Verenigde Arabische Emiraten,46.9,6 Verenigde Staten, 46.4,5 Oostenrijk,46.0,4 Australie,45.6,3 Finland,44.5,2 Zweden,44.0,1