We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone!
Can someone please check over this code, I keep getting different errors such as "missing semicolon?" at the end of the second string (the food groups one).
Is there anything obvious that I've done wrong to get the error?
String[] Title = "Food Group Consumption in Australia";
println(Title);
String[] foodGroups = ("Starchy Roots", "Sugars and Sweeteners", "Vegetables", "Fruits", "Spices", "Meat", "Offals", "Eggs", "Milks", "Seafood", "Aquatic Products");
println(foodGroups);
size(1500, 1500);
background(255);
smooth();
fill(#000000);
textSize(70);
text(Title, 100, 100);
noStroke();
//the data
float[] data = {
6, 9, 6, 25, 0, 12, 1, 2, 35, 7, 0
};
colorMode(HSB,data.length);
float t = 0;
for (int i=0;i<data.length;i++) {
t+=data[i];
}
// how much of each degree of the pie chart should each unit of data get
// in other words distributes our total data over 360 deg in preportion
t=360/t;
//two angles for each segment
float a1=0, a2=data[0];
//for each number in our data array
for (int i=0;i<data.length;i++) {
// choose a random fill
fill(i, 255, 255);
//put the last leading angle into a2
a2 = a1;
//update the current leading angle
a1 += data[i]*t;
//print the angles for debuging purposes
println(a1+" : "+a2);
//draw teh arc
arc(width/2, height/2, 1000, 1000, radians(a2), radians(a1));
}
for (int i=0;i<data.length;i++) {
t+=data[i];
}
t=width/t;
int x=0, y=0;
for (int i=0;i<data.length;i++) {
fill(i, 255, 255);
rect(x, y, data[i]*t, 10);
x+=(data[i]*t);
}
Answers
Solved. Thanks
OK, I answered on your other discussion.