Silly question, drawing lines from for loop
in
Contributed Library Questions
•
2 years ago
Hi all,
I am trying to draw out my data with lines going from top of sketch to bottom, spaced evenly apart with line widths determined by data from a spreadsheet. So, I am trying to get a simple gradient effect with my data.
Right now, I am getting a black box, or maybe it's with no spacing!
Is something wrong in my for-loop?
I am trying to draw out my data with lines going from top of sketch to bottom, spaced evenly apart with line widths determined by data from a spreadsheet. So, I am trying to get a simple gradient effect with my data.
Right now, I am getting a black box, or maybe it's with no spacing!
Is something wrong in my for-loop?
- float readVal;
float lineWidth;
SimpleSpreadsheetManager sm;
void setup() {
size(800,800);
background(255);
lineWidth = 3;
}
void draw(){
SimpleSpreadsheetManager sm = new SimpleSpreadsheetManager();
sm.init("sensor log3","@gmail.com", "WWWWWWWWWW4");
sm.fetchSheetByKey("0Ai-_2FVf77didEVZODdhUlBFNUJIS2lVLTU5d0FUR3c", 0);
for (int c=0; c < sm.currentTotalCols ; c++){
for (int r=0; r < sm.currentTotalRows ; r++){
float tempVal = Float.parseFloat(sm.getCellValue(2,r));
readVal = tempVal;
readVal = map(readVal,0,350,0,1);
println(readVal);
lineWidth = readVal;
strokeWeight(1*lineWidth);
line(r+5,0,r+5,height);
}
}
}
1