We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Pretty much what I have to do is get the data from the drones.csv file and plug it into processing and make something visual that accurately depicts the data in the different sections. So what I've done is create a green line that displays the years and have the rest of the information go along that line. Can you take a look at it maybe try adding something or just look it over see if it makes sense to you It would be greatly appreciated.
I pretty much just used the MAP tool in order to display the data. Although, Its not visually appealing I feel like more can be done I just don't know what or how to add to it, I've tried several different things that ended up in failure.
If you copy/paste this code into processing you wont be able to run it Unless you the CSV folder into the code because it contains all the data points.. I'm not sure how to attach the CSV file to this post though....
Here's the Code
void setup() {
size(640, 400, P3D);
}
void draw() {
background(0);
Table data = loadTable("drones.csv", "header,csv"); // Header Section, - Date, DEcimal_date - Min_killed - max-killed - civilin- children - iNJURED
//translate(width/2, height/2); // center the Image
//rotateX(PI/2);
for (TableRow row : data.rows() ) {
//Injured
float injured = row.getFloat("injured");
injured = int(injured);
//civilains
float civilian = row.getFloat("civilian");
civilian = int(civilian);
//Children
float children = row.getFloat("children");
children = int(children);
//DATE
// float date = row.getFloat("date");
float decimal_date = row.getFloat("decimal_date"); // Decimal date is a Float because it has a decimal point
decimal_date = (decimal_date);
//END-DATE
//KILLED SECTION
// float min_killed = row.getFloat("min_killed");
float max_kiled = row.getFloat("max_kiled");
//min_killed = radians(min_killed);
max_kiled = (max_kiled);
//KILLED SECTION END
//VISUAL-----------------------
//CREATING IMAGE FOR DATES/YEARS
float x1 = map(decimal_date, 2004, 2012, 0, width); //float x1 = map(decimal_date, 2004, 2012, 0, width); float x1 = map(decimal_date, 0, 2004, 0, 2012)
stroke(0,255,0); // Green will represent the Years
point(x1, 100);
//CREATING LINE FOR KILLING RATIO
float r = 140; //radius
float x2 = map(max_kiled, 2, 84, 0, width); // gets first value, targets value, high low for both, and sets out displayment.. Maps the 4 functions in the order I applied earlier
stroke(255,0,0); // red will Represent the deaths
point(x1,x2);
//Children
float children1 = map(children, 0, 69, 0, width);
stroke(255,255,255); // White
point(x1,children1);
//injured
float injured1 = map(injured, 0, 50, 0, width);
stroke(0,0,255); // blue
point(x1,injured1);
//
//civillian
float civilian1 = map(civilian, 0, 81, 0, width);
stroke(250,128,114); //Orange
point(x1,civilian1);
/*
//CAMERA
lights();
// Change height of the camera with mouseY
camera(30.0, mouseY, 220.0, // eyeX, eyeY, eyeZ
0.0, 0.0, 0.0, // centerX, centerY, centerZ
0.0, 1.0, 0.0); // upX, upY, upZ
*/
}
}
Answers
Since ".csv" files are human-readable text, you post it some of it here just for us to run your code! =:)
Also, check this post about how to format code in this forum: 8-X
http://forum.processing.org/two/discussion/473/unexpected-token-void-
Hey GoToLoop, Sorry for the late response i've been having some internet issues, I'm all set up now though :) anyway, I cant figure out how to post my .csv file here.. I keep getting strange errors, So i uploaded the file to dropbox so you can download it and plug it into the sketch and get it running.
here's the link https://www.dropbox.com/sh/d4lb70gc0lgg0v7/CUcbfgpo1n
If that dropbox link doesn't work try this one,
https://www.dropbox.com/sh/d4lb70gc0lgg0v7/CUcbfgpo1n