////////////////////////////////////////////////////////////////////////////////////////// // Final Project - Visualization Class // By Andres Burbano // Professor George Legrady // TA Angus Forbes // Media Arts and Technology // PhD Program // University of California - Santa Barbara // Winter 2009 ////////////////////////////////////////////////////////////////////////////////////////// // Import Libraries import processing.opengl.*; import java.util.*; ////////////////////////////////////////////////////////////////////////////////////////// // Varibles from Photo Chernoff Sketch PImage photos[] = new PImage[10]; PImage photosb[] = new PImage[10]; // variables text PFont font1, font2, font3; ////////////////////////////////////////////////////////////////////////////////////////// // Varibale for conditional int valor =0; ////////////////////////////////////////////////////////////////////////////////////////// //global List of the data ArrayList transactions = null; // arrays hours int[] arre ={ 0,0,0,0,0,0,0,0,0,0,0}; int[] arre1 ={ 0,0,0,0,0,0,0,0,0,0,0}; // arrays dewey categories int arr[] ={ 0,0,0,0,0,0,0, 0, 0,0}; int arr1[] ={ 0,0,0,0,0,0,0, 0, 0,0}; int arr2[] ={ 0,0,0,0,0,0,0, 0, 0,0}; int arr3[] ={ 0,0,0,0,0,0,0, 0, 0,0}; int arr4[] ={ 0,0,0,0,0,0,0, 0, 0,0}; int arr5[] ={ 0,0,0,0,0,0,0, 0, 0,0}; int arr6[] ={ 0,0,0,0,0,0,0, 0, 0,0}; int arr7[] ={ 0,0,0,0,0,0,0, 0, 0,0}; int arr8[] ={ 0,0,0,0,0,0,0, 0, 0,0}; int arr9[] ={ 0,0,0,0,0,0,0, 0, 0,0}; // Counters deey int cont2 =0; int cont3 =0; int cont4 =0; int cont5 =0; int cont6 =0; int cont7 =0; int cont8 =0; int cont9 =0; int cont10 =0; int cont11 =0; ////////////////////////////////////////////////////////////////////////////////////////// void setup() { size(1230,720, OPENGL); noStroke(); for (int i = 0; i < 10; i++) { photos[i] = loadImage("00" + (i+1) + ".png"); photosb[i] = loadImage("bianca/" + "00" + (i+1) + ".png"); } font1 = loadFont("Verdana-22.vlw"); font2 = loadFont("Verdana-14.vlw"); font3 = loadFont("Verdana-12.vlw"); // counter function counter(); } ////////////////////////////////////////////////////////////////////////////////////////// void draw() { background(0); fill(255, 100); rect(0,700,width,height); fill(0); textFont(font2,12); text("Seattle Public Library - ONE DAY DATA - Visualization by Andres Burbano - Data Visualization Course - Media Arts and Technology - University of California Santa Barbara - Winter 2009",20, 715); fill(255); stroke(255); for(int s = 0; s < 10; s++ ){ strokeWeight(70); line(1222, (s*70)+25, 1230,(s*70)+25); } for(int s = 0; s < 701; s+= 7 ){ strokeWeight(1); line(1227, s, 1230,s); } if (mouseY > 50){ text("hour " + "1" +((750 - mouseY)/70) +":00",1150,(700-mouseY)); } else { text("hour 20:00",1150,(700-mouseY)); } noStroke(); translate((width/2)-10,height/2.3,(mouseY*14)); LoadFaces(); LoadFaces1(); } ////////////////////////////////////////////////////////////////////////////////////////// String ho; void counter(){ // this functin counts the number of check in and check outs this.transactions = loadTransactions(nameOfDataFileWithinDataDirectory); for (int i=0; i < transactions.size() ; i++){ Transaction t = (Transaction)transactions.get(i); // Strings into SubStrings ho = t.ckotime.substring(0, 2); String hi = t.ckitime.substring(0, 2); String d1 = t.ckodate; String d2 = t.ckidate; String it = t.itemtype; String dc = t.deweyClass; // SubStrings into Ints int h_out = int(ho); int h_in = int(hi); if (dc != null && dc.length() >= 3){ String dc1 = t.deweyClass.substring(0,3); int dewe = int(dc1); int hora =0; for(int x =0; x < 10; x++){ hora = x + 10; if (dewe >= 0 && dewe < 100 && h_out == hora){ cont2 ++; if (x == hora-10){ arr[x]=cont2; } //println("dewe = " +dewe + " Dewey ONE " + " hora ="+ x +" total items = 000-100 -> " + arr[x]); } if (dewe >= 100 && dewe < 200 && h_out == hora){ cont3 ++; if (x == hora-10){ arr1[x]=cont3; } //println("dewe = " +dewe + " Dewey TWO " + " hora ="+ x +" total items = 100-200 -> " + arr1[x]); } else if (dewe >= 200 && dewe < 300 && h_out == hora){ cont4 ++; if (x == hora-10){ arr2[x]=cont4; } //println("dewe = " +dewe + " Dewey THREE " + " hora ="+ x +" total items = 200-300 -> " + arr2[x]); } else if (dewe >= 300 && dewe < 400 && h_out == hora){ cont5 ++; if (x == hora-10){ arr3[x]=cont5; } //println("dewe = " +dewe + " Dewey FOUR " + " hora ="+ x +" total items = 300-400 -> " + arr3[x]); } else if (dewe >= 400 && dewe < 500 && h_out == hora){ cont6 ++; if (x == hora-10){ arr4[x]=cont6; } //println("dewe = " +dewe + " Dewey FIVE " + " hora ="+ x +" total items = 400-500 -> " + arr4[x]); } else if (dewe >= 500 && dewe < 600 && h_out == hora){ cont7 ++; if (x == hora-10){ arr5[x]=cont7; } //println("dewe = " +dewe + " Dewey SIX " + " hora ="+ x +" total items = 500-600 -> " + arr5[x]); } else if (dewe >= 600 && dewe < 700 && h_out == hora){ cont8 ++; if (x == hora-10){ arr6[x]=cont8; } //println("dewe = " +dewe + " Dewey SEVEN " + " hora ="+ x +" total items = 600-700 -> " + arr6[x]); } else if (dewe >= 700 && dewe < 800 && h_out == hora){ cont9 ++; if (x == hora-10){ arr7[x]=cont9; } println("dewe = " +dewe + " Dewey EIGHT " + " hora ="+ x +" total items = 700-800 -> " + arr7[x]); } else if (dewe >= 800 && dewe < 900 && h_out == hora){ cont10 ++; if (x == hora-10){ arr8[x]=cont10; } //println("dewe = " +dewe + " Dewey NINE " + " hora ="+ x +" total items = 2800-900 -> " + arr8[x]); } else if (dewe >= 900 && dewe < 1000 && h_out == hora){ cont11 ++; if (x == hora-10){ arr9[x]=cont11; } //println("dewe = " +dewe + " Dewey TEN " + " hora ="+ x +" total items = 900-100 -> " + arr9[x]); } else{ println(" "); } } } // Reeds the array and compares with the Strings = Counter / Checkout for(int x =0; x <12; x++){ String x1= str(x+10); if (ho.equals (x1)){ arre[x]++; //println("there are: "+ arre[x] +" times " + (x+(10))+ " IN"); } } // Reeds the array and compares with the Strings = Counter / Check in for(int x =0; x <12; x++){ String x1= str(x+10); if (hi.equals (x1)){ arre1[x]++; //println("there are: "+ arre1[x] +" times " + (x+(10)) + " OUTS"); } } } } ////////////////////////////////////////////////////////////////////////////////////////// void LoadFaces(){ if (valor == 0){ for(int d =-10000; d < 0; d+=1000){ int xx=d; xx= (d+10000)/1000; ////////////////////////////////////////////////////////////////////// beginShape(); if (arre[xx] > 0 && arre[xx] < 150){ texture(photos[0]); } else if (arre[xx] > 150 && arre[xx] < 300){ texture(photos[1]); } else if (arre[xx]> 300 && arre[xx] < 450){ texture(photos[2]); } else if (arre[xx] > 450 && arre[xx] < 600){ texture(photos[3]); } else if (arre[xx] > 600 && arre[xx] < 750){ texture(photos[4]); } else if (arre[xx] > 750 && arre[xx] < 900){ texture(photos[5]); } else if (arre[xx] > 900 && arre[xx] < 1050){ texture(photos[6]); } else if (arre[xx] > 1050 && arre[xx] < 1300){ texture(photos[7]); } else if (arre[xx] > 1300 && arre[xx] < 1600){ texture(photos[8]); } else { texture(photos[9]); } int x = -300; vertex(x,-100,d,0,0); vertex(x+200,-100,d,450,0); vertex(x+200,100,d,450,450); vertex(x,100,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// beginShape(); if (arre1[xx] > -1 && arre1[xx] < 150){ texture(photos[0]); } else if (arre1[xx] > 151 && arre1[xx] < 300){ texture(photos[1]); } else if (arre1[xx]> 301 && arre1[xx] < 450){ texture(photos[2]); } else if (arre1[xx] > 451 && arre1[xx] < 600){ texture(photos[3]); } else if (arre1[xx] > 601 && arre1[xx] < 750){ texture(photos[4]); } else if (arre1[xx] > 751 && arre1[xx] < 900){ texture(photos[5]); } else if (arre1[xx] > 901 && arre1[xx] < 1050){ texture(photos[6]); } else if (arre1[xx] > 1051 && arre1[xx] < 1300){ texture(photos[7]); } else if (arre1[xx] > 1301 && arre1[xx] < 1600){ texture(photos[8]); } else { texture(photos[9]); } x = -100; vertex(x,-100,d,0,0); vertex(x+200,-100,d,450,0); vertex(x+200,100,d,450,450); vertex(x,100,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// beginShape(); if (arre[xx] + arre1[xx] > -1 && arre[xx] + arre1[xx] < 150){ texture(photos[0]); } else if ( arre[xx] + arre1[xx] > 151 && arre[xx] + arre1[xx] < 300){ texture(photos[1]); } else if ( arre[xx] + arre1[xx] > 301 && arre[xx] + arre1[xx] < 450){ texture(photos[2]); } else if ( arre[xx] + arre1[xx] > 451 && arre[xx] + arre1[xx] < 600){ texture(photos[3]); } else if ( arre[xx] + arre1[xx] > 601 && arre[xx] + arre1[xx] < 750){ texture(photos[4]); } else if ( arre[xx] + arre1[xx] > 751 && arre[xx] + arre1[xx] < 900){ texture(photos[5]); } else if ( arre[xx] + arre1[xx] > 901 && arre[xx] + arre1[xx] < 1050){ texture(photos[6]); } else if ( arre[xx] + arre1[xx] > 1051 && arre[xx] + arre1[xx] < 1300){ texture(photos[7]); } else if ( arre[xx] + arre1[xx] > 1301 && arre[xx] + arre1[xx] < 1600){ texture(photos[8]); } else { texture(photos[9]); } x = 100; vertex(x,-100,d,0,0); vertex(x+200,-100,d,450,0); vertex(x+200,100,d,450,450); vertex(x,100,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// fill(255,150); text("Check Out ",-240,170,d); fill(255); text(arre[xx],-170,170,d); fill(255,150); text("Check In ",-30,170,d); fill(255); text(arre1[xx],30,170,d); fill(255,150); text("Total Traffic ", 160,170,d); fill(255); text((arre1[xx] + arre[xx]),240,170,d); text(("Hour " + " 1"+xx +" :00"),-30,240,d); } } } ////////////////////////////////////////////////////////////////////////////////////////// void LoadFaces1(){ if (valor == 255){ for(int d =-10000; d < 0; d+=1000){ int xx=d; xx= (d+10000)/1000; ////////////////////////////////////////////////////////////////////// beginShape(); if ((arr[xx]/10) >= 0 && (arr[xx]/10) < 5){ texture(photosb[0]); } else if ((arr[xx]/10) >= 5 && (arr[xx]/10) < 10){ texture(photosb[1]); } else if ((arr[xx]/10)>= 10 && (arr[xx]/10) < 25){ texture(photosb[2]); } else if ((arr[xx]/10) >= 25 && (arr[xx]/10) < 30){ texture(photosb[3]); } else if ((arr[xx]/10) >= 30 && (arr[xx]/10) < 55){ texture(photosb[4]); } else if ((arr[xx]/10) >= 55 && (arr[xx]/10) < 80){ texture(photosb[5]); } else if ((arr[xx]/10) >= 80 && (arr[xx]/10) < 105){ texture(photosb[6]); } else if ((arr[xx]/10) >= 105 && (arr[xx]/10) < 130){ texture(photosb[7]); } else if ((arr[xx]/10) >= 130 && (arr[xx]/10) < 160){ texture(photosb[8]); } else { texture(photosb[9]); } int x = -500; vertex(x,-200,d,0,0); vertex(x+200,-200,d,450,0); vertex(x+200,0,d,450,450); vertex(x,0,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// beginShape(); if ((arr1[xx]/10) >= 0 && (arr1[xx]/10) < 5){ texture(photosb[0]); } else if ((arr1[xx]/10) >= 5 && (arr1[xx]/10) < 10){ texture(photosb[1]); } else if ((arr1[xx]/10)>= 10 && (arr1[xx]/10) < 25){ texture(photosb[2]); } else if ((arr1[xx]/10) >= 25 && (arr1[xx]/10) < 30){ texture(photosb[3]); } else if ((arr1[xx]/10) >= 30 && (arr1[xx]/10) < 55){ texture(photosb[4]); } else if ((arr1[xx]/10) >= 55 && (arr1[xx]/10) < 80){ texture(photosb[5]); } else if ((arr1[xx]/10) >= 80 && (arr1[xx]/10) < 105){ texture(photosb[6]); } else if ((arr1[xx]/10) >= 105 && (arr1[xx]/10) < 130){ texture(photosb[7]); } else if ((arr1[xx]/10) >= 130 && (arr1[xx]/10) < 160){ texture(photosb[8]); } else { texture(photosb[9]); } x = -300; vertex(x,-200,d,0,0); vertex(x+200,-200,d,450,0); vertex(x+200,0,d,450,450); vertex(x,0,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// beginShape(); if ((arr2[xx]/10) >= 0 && (arr2[xx]/10) < 5){ texture(photosb[0]); } else if ((arr2[xx]/10) >= 5 && (arr2[xx]/10) < 10){ texture(photosb[1]); } else if ((arr2[xx]/10)>= 10 && (arr2[xx]/10) < 25){ texture(photosb[2]); } else if ((arr2[xx]/10) >= 25 && (arr2[xx]/10) < 30){ texture(photosb[3]); } else if ((arr2[xx]/10) >= 30 && (arr2[xx]/10) < 55){ texture(photosb[4]); } else if ((arr2[xx]/10) >= 55 && (arr2[xx]/10) < 80){ texture(photosb[5]); } else if ((arr2[xx]/10) >= 80 && (arr2[xx]/10) < 105){ texture(photosb[6]); } else if ((arr2[xx]/10) >= 105 && (arr2[xx]/10) < 130){ texture(photosb[7]); } else if ((arr2[xx]/10) >= 130 && (arr2[xx]/10) < 160){ texture(photosb[8]); } else { texture(photosb[9]); } x = -100; vertex(x,-200,d,0,0); vertex(x+200,-200,d,450,0); vertex(x+200,0,d,450,450); vertex(x,0,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// beginShape(); if ((arr3[xx]/10) >= 0 && (arr3[xx]/10) < 5){ texture(photosb[0]); } else if ((arr3[xx]/10) >= 5 && (arr3[xx]/10) < 10){ texture(photosb[1]); } else if ((arr3[xx]/10)>= 10 && (arr3[xx]/10) < 25){ texture(photosb[2]); } else if ((arr3[xx]/10) >= 25 && (arr3[xx]/10) < 30){ texture(photosb[3]); } else if ((arr3[xx]/10) >= 30 && (arr3[xx]/10) < 55){ texture(photosb[4]); } else if ((arr3[xx]/10) >= 55 && (arr3[xx]/10) < 80){ texture(photosb[5]); } else if ((arr3[xx]/10) >= 80 && (arr3[xx]/10) < 105){ texture(photosb[6]); } else if ((arr3[xx]/10) >= 105 && (arr3[xx]/10) < 130){ texture(photosb[7]); } else if ((arr3[xx]/10) >= 130 && (arr3[xx]/10) < 160){ texture(photosb[8]); } else { texture(photosb[9]); } x = 100; vertex(x,-200,d,0,0); vertex(x+200,-200,d,450,0); vertex(x+200,0,d,450,450); vertex(x,0,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// beginShape(); if ((arr4[xx]/10) >= 0 && (arr4[xx]/10) < 5){ texture(photosb[0]); } else if ((arr4[xx]/10) >= 5 && (arr4[xx]/10) < 10){ texture(photosb[1]); } else if ((arr4[xx]/10)>= 10 && (arr4[xx]/10) < 25){ texture(photosb[2]); } else if ((arr4[xx]/10) >= 25 && (arr4[xx]/10) < 30){ texture(photosb[3]); } else if ((arr4[xx]/10) >= 30 && (arr4[xx]/10) < 55){ texture(photosb[4]); } else if ((arr4[xx]/10) >= 55 && (arr4[xx]/10) < 80){ texture(photosb[5]); } else if ((arr4[xx]/10) >= 80 && (arr4[xx]/10) < 105){ texture(photosb[6]); } else if ((arr4[xx]/10) >= 105 && (arr4[xx]/10) < 130){ texture(photosb[7]); } else if ((arr4[xx]/10) >= 130 && (arr4[xx]/10) < 160){ texture(photosb[8]); } else { texture(photosb[9]); } x = 300; vertex(x,-200,d,0,0); vertex(x+200,-200,d,450,0); vertex(x+200,0,d,450,450); vertex(x,0,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// beginShape(); if ((arr5[xx]/10) >= 0 && (arr5[xx]/10) < 5){ texture(photosb[0]); } else if ((arr5[xx]/10) >= 5 && (arr5[xx]/10) < 10){ texture(photosb[1]); } else if ((arr5[xx]/10)>= 10 && (arr5[xx]/10) < 25){ texture(photosb[2]); } else if ((arr5[xx]/10) >= 25 && (arr5[xx]/10) < 30){ texture(photosb[3]); } else if ((arr5[xx]/10) >= 30 && (arr5[xx]/10) < 55){ texture(photosb[4]); } else if ((arr5[xx]/10) >= 55 && (arr5[xx]/10) < 80){ texture(photosb[5]); } else if ((arr5[xx]/10) >= 80 && (arr5[xx]/10) < 105){ texture(photosb[6]); } else if ((arr5[xx]/10) >= 105 && (arr5[xx]/10) < 130){ texture(photosb[7]); } else if ((arr5[xx]/10) >= 130 && (arr5[xx]/10) < 160){ texture(photosb[8]); } else { texture(photosb[9]); } x = -500; vertex(x,0,d,0,0); vertex(x+200,0,d,450,0); vertex(x+200,200,d,450,450); vertex(x,200,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// beginShape(); if ((arr6[xx]/10) >= 0 && (arr6[xx]/10) < 5){ texture(photosb[0]); } else if ((arr6[xx]/10) >= 5 && (arr6[xx]/10) < 10){ texture(photosb[1]); } else if ((arr6[xx]/10)>= 10 && (arr6[xx]/10) < 25){ texture(photosb[2]); } else if ((arr6[xx]/10) >= 25 && (arr6[xx]/10) < 30){ texture(photosb[3]); } else if ((arr6[xx]/10) >= 30 && (arr6[xx]/10) < 55){ texture(photosb[4]); } else if ((arr6[xx]/10) >= 55 && (arr6[xx]/10) < 80){ texture(photosb[5]); } else if ((arr6[xx]/10) >= 80 && (arr6[xx]/10) < 105){ texture(photosb[6]); } else if ((arr6[xx]/10) >= 105 && (arr6[xx]/10) < 130){ texture(photosb[7]); } else if ((arr6[xx]/10) >= 130 && (arr6[xx]/10) < 160){ texture(photosb[8]); } else { texture(photosb[9]); } x = -300; vertex(x,0,d,0,0); vertex(x+200,0,d,450,0); vertex(x+200,200,d,450,450); vertex(x,200,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// beginShape(); if ((arr7[xx]/10) >= 0 && (arr7[xx]/10) < 5){ texture(photosb[0]); } else if ((arr7[xx]/10) >= 5 && (arr7[xx]/10) < 10){ texture(photosb[1]); } else if ((arr7[xx]/10)>= 10 && (arr7[xx]/10) < 25){ texture(photosb[2]); } else if ((arr7[xx]/10) >= 25 && (arr7[xx]/10) < 30){ texture(photosb[3]); } else if ((arr7[xx]/10) >= 30 && (arr7[xx]/10) < 55){ texture(photosb[4]); } else if ((arr7[xx]/10) >= 55 && (arr7[xx]/10) < 80){ texture(photosb[5]); } else if ((arr7[xx]/10) >= 80 && (arr7[xx]/10) < 105){ texture(photosb[6]); } else if ((arr7[xx]/10) >= 105 && (arr7[xx]/10) < 130){ texture(photosb[7]); } else if ((arr7[xx]/10) >= 130 && (arr7[xx]/10) < 160){ texture(photosb[8]); } else { texture(photosb[9]); } x = -100; vertex(x,0,d,0,0); vertex(x+200,0,d,450,0); vertex(x+200,200,d,450,450); vertex(x,200,d,0,450); endShape(); ////////////////////////////////////////////////////////////////////// beginShape(); if ((arr8[xx]/10) >= 0 && (arr8[xx]/10) < 5){ texture(photosb[0]); } else if ((arr8[xx]/10) >= 5 && (arr8[xx]/10) < 10){ texture(photosb[1]); } else if ((arr8[xx]/10)>= 10 && (arr8[xx]/10) < 25){ texture(photosb[2]); } else if ((arr8[xx]/10) >= 25 && (arr8[xx]/10) < 30){ texture(photosb[3]); } else if ((arr8[xx]/10) >= 30 && (arr8[xx]/10) < 55){ texture(photosb[4]); } else if ((arr8[xx]/10) >= 55 && (arr8[xx]/10) < 80){ texture(photosb[5]); } else if ((arr8[xx]/10) >= 80 && (arr8[xx]/10) < 105){ texture(photosb[6]); } else if ((arr8[xx]/10) >= 105 && (arr8[xx]/10) < 130){ texture(photosb[7]); } else if ((arr8[xx]/10) >= 130 && (arr8[xx]/10) < 160){ texture(photosb[8]); } else { texture(photosb[9]); } x = 100; vertex(x,0,d,0,0); vertex(x+200,0,d,450,0); vertex(x+200,200,d,450,450); vertex(x,200,d,0,450); endShape(); beginShape(); if ((arr9[xx]/10) >= 0 && (arr9[xx]/10) < 5){ texture(photosb[0]); } else if ((arr9[xx]/10) >= 5 && (arr9[xx]/10) < 10){ texture(photosb[1]); } else if ((arr9[xx]/10)>= 10 && (arr9[xx]/10) < 25){ texture(photosb[2]); } else if ((arr9[xx]/10) >= 25 && (arr9[xx]/10) < 30){ texture(photosb[3]); } else if ((arr9[xx]/10) >= 30 && (arr9[xx]/10) < 55){ texture(photosb[4]); } else if ((arr9[xx]/10) >= 55 && (arr9[xx]/10) < 80){ texture(photosb[5]); } else if ((arr9[xx]/10) >= 80 && (arr9[xx]/10) < 105){ texture(photosb[6]); } else if ((arr9[xx]/10) >= 105 && (arr9[xx]/10) < 130){ texture(photosb[7]); } else if ((arr9[xx]/10) >= 130 && (arr9[xx]/10) < 160){ texture(photosb[8]); } else { texture(photosb[9]); } x = 300; vertex(x,0,d,0,0); vertex(x+200,0,d,450,0); vertex(x+200,200,d,450,450); vertex(x,200,d,0,450); endShape(); fill(255); text(("Hour " + " 1"+xx +" :00"),-30,240,d); fill(255,120); text("Dewey 000/099",-450,5,d+1); fill(255); text(int(arr[xx]/10),-350,5,d+1); fill(255,120); text("Dewey 100/199",-250,5,d+1); fill(255); text(int(arr1[xx]/10),-150,5,d+1); fill(255,120); text("Dewey 200/299",-50,5,d+1); fill(255); text(int(arr2[xx]/10),50,5,d+1); fill(255,120); text("Dewey 300/399",150,5,d+1); fill(255); text(int(arr3[xx]/10),250,5,d+1); fill(255,120); text("Dewey 400/499",350,5,d+1); fill(255); text(int(arr4[xx]/10),450,5,d+1); fill(255,120); text("Dewey 500/599",-450,207,d+1); fill(255); text(int(arr5[xx]/10),-350, 207,d+1); fill(255,120); text("Dewey 600/699",-250,207,d+1); fill(255); text(int(arr6[xx]/10),-150, 207,d+1); fill(255,120); text("Dewey 700/799",-50,207,d+1); fill(255); text(int(arr7[xx]/10),50, 207,d+1); fill(255,120); text("Dewey 800/899",150,207,d+1); fill(255); text(int(arr8[xx]/10),250, 207,d+1); fill(255,120); text("Dewey 900/999",350,207,d+1); fill(255); text(int(arr9[xx]/10),450, 207,d+1); ////////////////////////////////////////////////////////////////////// } } } ///////////////////////////////////////////////////////////////////////////////////////// String nameOfDataFileWithinDataDirectory = "smalldata.txt"; public ArrayList loadTransactions(String nameOfDataFileWithinDataDirectory) { ArrayList transactions = new ArrayList(); String[] lines = loadStrings(nameOfDataFileWithinDataDirectory); for (int i = 0; i < lines.length; i++) { transactions.add(parseTransaction(lines[i])); } return transactions; } ////////////////////////////////////////////////////////////////////////////////////////// // This function returns all the files in a directory as an array of File objects // This is useful if you want more info about the file public File[] listFiles(String dir) { File file = new File(dir); if (file.isDirectory()) { File[] files = file.listFiles(); return files; } else { // If it's not a directory return null; } } ////////////////////////////////////////////////////////////////////////////////////////// //create a new transaction obejct from a comma separated line. For this example we are only storing subjects. public Transaction parseTransaction(String line) { String sections[] = split(line, ","); Transaction t = new Transaction(); t.ckodate = sections[0]; t.ckotime = sections[1]; t.ckidate = sections[2]; t.ckitime = sections[3]; t.itemtype = sections[4]; t.deweyClass = sections[5]; // "ckodate", "ckotime", "ckidate", "ckitime", "itemtype", "deweyClass" return t; } ///////////////////////////////////////////////////////////////////////////////////////// void keyPressed(){ if (valor == 0){ valor = 255; println("valor 255 : " + valor); } else{ valor =0; println("valor 0 : " + valor); } } /////////////////////////////////////////////////////////////////////////////////////////