processing

데이터 과제

프로필

2018. 4. 18. 1:45

이웃추가



This is the inspirational data visualization work, but I failed to make data to squares. 

I collected daily datas about how long I am using smartphone and how many times I see the sky. 

So, the angle of arc means how long and the radius is how many times. 


Q1. I wanted to make colors changed like spectrum. How can I do that? 


 


PImage img;
boolean mouse;
String[] data;
int[] minute;
int[] time; 


void setup() {
  size(960,540);
  img = loadImage("background.png");
  data = loadStrings("data.txt");
  minute = new int[data.length];
  time = new int[data.length]; 
  
  for (int i=0; i<data.length; i++) {
    println(data[i]);
    String[] values= splitTokens(data[i]," "); 
    minute[i] = int(values[0]);
    time[i] = int(values[1]); 
  }
}

void mouseClicked() {
 mouse=!mouse; 
}

void draw() {
  image(img,0,0);
 if(mouse == true) {
   background(0); 
   for (int i=0; i<data.length; i++) {
     float colors=i*21;
     fill(colors,256-colors,colors,50);
     strokeWeight(1);
     stroke(255);
     arc(480,270,(time[i]+1)*100,(time[i]+1)*100,radians(-90),radians(minute[i]*2.5),PIE) ; 
     
   }
   } 

 


솔

자기소개를 입력하세요.