var table; var gdp; var networth; var the_name; function preload(){ table = loadTable('billionaires.csv', 'csv','header'); } function setup() { createCanvas(800, 600); the_name = []; networth =[]; gdp=[]; for(var r=0; r<1200;r++){ if(!(table.getString(r,"gdp")==0)){ networth.push(table.getString(r, "worth in billions")); print(table.getString(r, "worth in billions")); the_name.push(table.getString(r,"name")); gdp.push(Number.parseFloat(table.getString(r, "gdp")/10000000000).toPrecision(4)); } } textSize(10); textAlign(CENTER); fill(0); } function draw() { // var year = [1996, 2001, 2014]; // var networth = [18.5, 58.7, 76]; var count=gdp.length; background(204); stroke(153); //11 line(60,60,60,260); line(60,260,340,260); //21 line(60,360,60,540); line(60,540,340,540); //12 line(460,60,460,260); line(460,260,740,260); //22 line(460,360,460,540); line(460,540,740,540); //11 fill(0,0,0); strokeWeight(1); text("Net Worth/B", 50, 60); fill(0,0,0); strokeWeight(1); text("log(GDP)/l(B)", 370, 270); fill(0,0,0); strokeWeight(1); fill(0,0,0); strokeWeight(1); text("Networth vs log(GDP)/l(B)", 200, 80); //21 fill(0,0,0); strokeWeight(1); text("log(GDP)/l(B)", 50, 360); fill(0,0,0); strokeWeight(1); text("log(GDP)/l(B)", 370, 550); fill(0,0,0); strokeWeight(1); text("log(GDP)/l(B) vs log(GDP)/l(B)", 200, 380); //12 fill(0,0,0); strokeWeight(1); text("Net Worth/B", 750, 270); fill(0,0,0); strokeWeight(1); text("Net Worth/B", 450, 60); fill(0,0,0); strokeWeight(1); text("Networth vs Networth", 600, 80); //22 fill(0,0,0); strokeWeight(1); text("log(GDP)/l(B)", 450, 360); fill(0,0,0); strokeWeight(1); text("Networth/B", 750, 550); fill(0,0,0); strokeWeight(1); text("log(GDP)/l(B) vs Networth", 600, 380); print(max(networth)); //11 for(var i=0; i<6; i++){ fill(0,0,0); text(max(networth)+1.3-12*i, 50, max(networth)+27+35*i); } for(var i=0; i<4; i++){ fill(0,0,0); // var num = Math.round(min(gdp)); text(i, 60+85*i, 270); } //12 for(var i=0; i<6; i++){ fill(0,0,0); text(max(networth)+1.3-12*i, 450, max(networth)+27+35*i); } for(var i=0; i<6; i++){ fill(0,0,0); text(max(networth)+1.3-12*i, max(networth)+650-49*i, 270); } //21 for(var i=0; i<4; i++){ fill(0,0,0); // var num = Math.round(min(gdp)); text(i, 60+85*i, 550); } for(var i=0; i<4; i++){ fill(0,0,0); // var num = Math.round(min(gdp)); text(i, 50, 540-50*i); } //22 for(var i=0; i<6; i++){ fill(0,0,0); text(max(networth)+1.3-12*i, max(networth)+650-49*i, 550); } for(var i=0; i<4; i++){ fill(0,0,0); // var num = Math.round(min(gdp)); text(i, 450, 540-50*i); } //11 for(var i=0; i