import java.util.*; PFont font1, font2, font3, font4, font5, font6; Date [] CkoutDates; Date [] CkinDates; int [] Category; long [] Differences; long MaxTime=0; int [] TransCat ={0,0,0,0}; int [][] CataDetail = new int[6][10]; int [][] Econ = new int[10][30];//10 subCategory, 30 days int [][] Tech = new int[10][30]; int [][] Fami = new int[10][30]; int [][] Arts = new int[10][30]; int [][] Musi = new int[10][30]; int [][] Poli = new int[10][30]; String[] Year = {"06", "07", "08", "09", "10"}; String[] Month = {"01","02","03","04","05","06","07","08","09","10","11","12"}; //String[] Month = {"03","04"}; int monthIdx = 0; int countDewey = 0; String[] DeweyNumbers = {"POLI", "ECON", "TECH", "FAMI", "MUSIC", "ARTS"}; float hexSideLength = 9.0; int wholePlotX = 50; int wholePlotY = 40; int textHeight = 420; int MouseTextW = 450; int MouseTextH = 550; int SideDetailH = 490; int SideDetailW = 50; int SideNumW = 1240; float alphaEcon=0.0; float alphaTech=0.0; float alphaFami=0.0; float alphaArts=0.0; float alphaMusi=0.0; float alphaPoli=0.0; boolean EconBoolean = false; boolean TechBoolean = false; boolean FamiBoolean = false; boolean ArtsBoolean = false; boolean MusiBoolean = false; boolean PoliBoolean = false; boolean showGrid = false; boolean showPlot = true; boolean monthUpdated = false; int CenterPoli = 5; int CenterEcon = 15; int CenterTech = 25; int CenterFami = 35; int CenterMusi = 43; int CenterArts = 53; int[][] colorIdx = { {81,11,45}, {86,29,6}, {189,23,71},{194,102,11}, {211,128,170},{91,2,28}, {0,255,0}}; //{231,159,181} void CategoryReset(int[][] Category){ for(int i = 0; i < 10; i++){ for(int j = 0; j < 30; j++){ Category[i][j] = 0; } } } void CataDetailReset(){ for(int i = 0; i < 4; i++){ for(int j = 0; j < 10; j++){ CataDetail[i][j]=0; } } } void setup(){ size(1024,768); background(255); smooth(); font1 = loadFont("HelveticaNeue-Light-18.vlw"); font2 = loadFont("HiraMaruProN-W4-13.vlw"); font3 = loadFont("HelveticaNeue-Light-22.vlw"); font4 = loadFont("HelveticaNeue-Light-12.vlw"); font5 = loadFont("HelveticaNeue-Light-8.vlw"); font6 = loadFont("Arial-Black-40.vlw"); getData(); } void draw(){ background(255); MouseControl(); CatalogDetail(); if(monthUpdated){ getData(); monthUpdated = false; } pushMatrix(); translate(wholePlotX,wholePlotY); drawHexagon(hexSideLength,10,30,0, Poli); translate(10*hexSideLength*sqrt(3), 0); drawHexagon(hexSideLength,10,30,1, Econ); translate(10*hexSideLength*sqrt(3), 0); drawHexagon(hexSideLength,10,30,2, Tech); translate(10*hexSideLength*sqrt(3), 0); drawHexagon(hexSideLength,10,30,3, Fami); translate(10*hexSideLength*sqrt(3), 0); drawHexagon(hexSideLength,10,30,4, Musi); translate(10*hexSideLength*sqrt(3), 0); drawHexagon(hexSideLength,10,30,5, Arts); popMatrix(); drawTitle(); pushMatrix(); translate(wholePlotX,wholePlotY); drawNames(CenterPoli, 0, 0); drawNames(CenterEcon, 1, 1); drawNames(CenterTech, 2, 2); drawNames(CenterFami, 3, 3); drawNames(CenterMusi, 4, 4); drawNames(CenterArts, 5, 5); popMatrix(); if(showPlot){ drawPlot(); } pushMatrix(); translate(wholePlotX-1,wholePlotY); if(showGrid){ drawGrid(hexSideLength, 60, 15); } popMatrix(); // if(yearUpdated){ // //TransReset(); // CataDetailReset(); // InitialHexColor(); // getData(); // InitialHexColor(); // yearUpdated = false; // } // CategoryReset(Econ); // CategoryReset(Tech); // CategoryReset(Fami); // CategoryReset(Arts); // CategoryReset(Musi); // CategoryReset(Poli); // print(MaxTrans(Econ)); } void keyPressed(){ if(key == CODED){ if(keyCode == DOWN){ if(showGrid){ showGrid = false; } else{ showGrid = true; } } if(keyCode == RIGHT){ if(monthIdx>=11){ monthIdx = 0; }else{ monthIdx++; } monthUpdated = true; println(monthIdx); } else if(keyCode == LEFT){ if(monthIdx<=0){ monthIdx = 11; } else{ monthIdx--; } monthUpdated = true; println(monthIdx); } else if(keyCode == UP){ if(showPlot){ showPlot = false; } else{ showPlot = true; } } } if(key == '1'){ if(PoliBoolean){ PoliBoolean = false; } else{ EconBoolean = false; PoliBoolean = true; ArtsBoolean = false; FamiBoolean = false; TechBoolean = false; MusiBoolean = false; } } if(key == '2'){ if(EconBoolean){ EconBoolean = false; } else{ EconBoolean = true; PoliBoolean = false; ArtsBoolean = false; FamiBoolean = false; TechBoolean = false; MusiBoolean = false; } } if(key == '3'){ if(TechBoolean){ TechBoolean = false; } else{ EconBoolean = false; PoliBoolean = false; ArtsBoolean = false; FamiBoolean = false; TechBoolean = true; MusiBoolean = false; } } if(key == '4'){ if(FamiBoolean){ FamiBoolean = false; } else{ EconBoolean = false; PoliBoolean = false; ArtsBoolean = false; FamiBoolean = true; TechBoolean = false; MusiBoolean = false; } } if(key == '5'){ if(MusiBoolean){ MusiBoolean = false; } else{ EconBoolean = false; PoliBoolean = false; ArtsBoolean = false; FamiBoolean = false; TechBoolean = false; MusiBoolean = true; } } if(key == '6'){ if(ArtsBoolean){ ArtsBoolean = false; } else{ EconBoolean = false; PoliBoolean = false; ArtsBoolean = true; FamiBoolean = false; TechBoolean = false; MusiBoolean = false; } } }