Right now I have a bar graph representing 54 weeks of data. However, I would like if there was some way to label each week (represented by a bar) on the graph either (1, 2, 3....) or (week 1, week 2, week, 3) ?
String rawData[];
String Data[][];
float xPos;
float yPos;
int fieldNum = 2;
int margin = 100;
float rectX = 6;
//Week 0
int xMin = 0;
//Week 54
int xMax = 54;
//Number of emails per week
int yMin = 1;
int yMax = 101;
color c1= color(255, 0, 0);
void setup(){
size(1200,700);
//file- (1-54 weeks 5/01/11- 5/07/12)
rawData = loadStrings("protwo.csv");
Data = new String[rawData.length][fieldNum];
for (int i=0; i < rawData.length; i++){
Data[i] = rawData[i].split(",");
}
}
void draw() {
background(220);
stroke(0, 0, 230);
for (int n=0; n < rawData.length; n++){
xPos = map(int(Data[n][0]), xMin, xMax, 0+margin, width-margin);
yPos = map(int(Data[n][1]), yMin, yMax, 0, height-(margin+50));
fill(c1);
rectMode(CORNER);
rect(xPos, height-margin, rectX, -1*yPos);
}
}
1