Help figuring out how to make a certain shape
in
Programming Questions
•
6 months ago
Hi all! I'm taking an Electronic Arts class and for one of our projects we were given the task of visualizing data. I have all the data imported and sorted into arrays, but now am facing a difficulty.
My project is based on my dreams, with the dream entries being sorted by word count. I wanted to create a line that would vary in height based on the wordcount in an entry, and then stack these up to make a graphic that looked something like this. This is proving more difficult than I first thought, and I'm not sure how to actually create this line with my current code. Ideally it would go down the counter increment and then change the height of the line based on the total that I got by finding the total amount of each word.
Here is the code I have so far that I got with the help of my teacher. Any help would be appreciated!:
My project is based on my dreams, with the dream entries being sorted by word count. I wanted to create a line that would vary in height based on the wordcount in an entry, and then stack these up to make a graphic that looked something like this. This is proving more difficult than I first thought, and I'm not sure how to actually create this line with my current code. Ideally it would go down the counter increment and then change the height of the line based on the total that I got by finding the total amount of each word.
Here is the code I have so far that I got with the help of my teacher. Any help would be appreciated!:
- PFont f;
int displayLetter;
String[] dreamData;
int counter = 0;
String delimiters = " ,.?!;:";
int total=1;
void setup() {
size(500, 500,P3D);
translate(0,0,0);
f = loadFont("CharterBT-Roman-16.vlw");
String[] rawtext = loadStrings("1_25_2013.txt");
String everything = join(rawtext, " ");
textSize(3);
dreamData = splitTokens(everything, delimiters);
//frameRate(.5);
}
void draw() {
background(0);
//String I = dreamData[counter];
dreamData=sort(dreamData);
for (int i=0;i<dreamData.length-1;i++) {
if (dreamData[i].equals(dreamData[i+1])) {
total++;
}else {
counter++;
/* previous attempts at visualization with different forms - textFont(f);
fill(0);
text(dreamData[i], (total/4)+30, 2*i);
text(total, (total/4)+5, 20*i);
stroke(255);
fill(0);
ellipse(counter+250, counter+250, total*20, total*20);
total=1; */
}
noLoop();
}
}
1