var table; var xaxis = []; var yaxis = []; var wortharray = []; var yeararray = []; var foundedarray = []; var rankarray = []; var gdparray = []; var minx = 0; function preload() { //my table is comma separated value "csv“ and has a header specifying the columns labels table = loadTable('billionaires.csv', 'csv','header'); } function setup() { //count the columns var width = 800, height = 800, margin = 20, w = width - 2 * margin, h = height - 2 * margin; var columnforx = 22, columnfory = 20; createCanvas(width, height); sumarray = {}; allyears = table.getColumn('year'); allworths = table.getColumn('worth in billions'); allgenders = table.getColumn('genders'); allfounded = table.getColumn('founded'); allranks = table.getColumn('rank'); allgdps = table.getColumn('gdp'); datapoints = allyears.length; noLoop(); } function findyvalue(mousecoord,arrayhere){ } function draw(){ background(255); xstart=50; xend=800; ystart=50; yend=450; fill("grey"); line(xstart, yend, 50, 50); //Y-axis line(50, 450, 500, 450); //X-axis fill("Black"); text("Parallel Coordinates",225,40); rotate(-PI/2); text("Total Worth in Billions", -500, 40); text("Year", -500, 150); text("Founded", -500, 250); text("Rank", -500, 350); text("GDP", -500, 450); rotate(PI/2); for (worth of allworths) { posy = map(worth, min(allworths), max(allworths), 50, 450); wortharray.push(posy); fill("blue"); if(mouseX>50 && mouseX<150){ pos_string = findyvalue(mouseY,wortharray); // text(pos_string,50,posy); } ellipse(50, posy, 3, 3); } for (year of allyears) { posy = map(year, min(allyears), max(allyears), 50, 450); yeararray.push(posy);fill("blue"); ellipse(150, posy, 3, 3); } for (year of allfounded) { posy = map(year, min(allfounded), max(allfounded), 50, 450); foundedarray.push(posy);fill("blue"); ellipse(250, posy, 3, 3); } for (rank of allranks) { posy = map(rank, min(allranks), max(allranks), 50, 450); rankarray.push(posy);fill("blue"); ellipse(350, posy, 3, 3); } for (gdp of allgdps) { posy = map(gdp, min(allgdps), max(allgdps), 50, 450); gdparray.push(posy);fill("blue"); ellipse(450, posy, 3, 3); } for(i=0;i