We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I can't get it to read the coordinates for the y-axis. xy consists of these numbers: -13.3,-16.39,-5.51,-2.96,4.65,9.0,11.97,10.57,6.09,-0.35,-5.52,-15.84 Could i get a hint to what i'm doing wrong? And why didn't Float.parseFloat work? Thank you!
//float[] tall = {-13.3,-16.39,-5.51,-2.96,4.65,9.0,11.97,10.57,6.09,-0.35,-5.52,-15.84};
String[] line = loadStrings("data/xy.csv");
String[] list = split(line[0], ',');
//float f = Float.parseFloat(line);
size(1000, 800);
for(int i = 0; i < line.length; i++) {
float xpos = map(i, 0, line.length, 50, width - 100);
float ypos = map(list[i], -5, 40, height, 0);
stroke(0);
fill(255);
rect(xpos, ypos, 70, 1);//Array
fill(0);
rect(0,266,930,1);//x-akse
rect(30,0,1,600);//y-akse
stroke(255);
}
Comments
Float.parseFloat(line)
did not work because line is an array and this method expects a singleString
.You might try changing line 10 to
I don't have the time right now to test your code but I hope this helps.
I tried, but it still won't display any data. Basically I'm trying to create a histogram, but i think I might be doing it wrong.
Some errors:
I guess I had it in immediate mode, but here is an edited version. But how can i get the float() function to get data from loadStrings()? Thanks for the help so far, but I'm pretty new to this!
Perhaps this 1 is close to whatcha want? 8-X
Thank you guys! That last example worked after i added it to my own code. I sat grinding my teeth pretty long before I asked the forum, so you saved me a trip to the dentist ^^