I'm trying to adapt the pie chart example form the learning area to work from an array of 3 changing values, but I'm having trouble making my pie chart draw itself as a full circle before diviing itself proportionally, it always seems to draw an incomplete circle..?
Here is the example, an easy way to see what I mean is just to delete some of the values from the string - the other slices dont change, sections just disappear!
Code:
size(200, 200);
background(100);
smooth();
noStroke();
int diameter = 150;
int[] angs = {30, 10, 45, 35, 60, 38, 75, 67};
float lastAng = 0;
for (int i = 0; i < angs.length; i++){
fill(angs[i] * 3.0);
arc(width/2, height/2, diameter, diameter, lastAng, lastAng+radians(angs[i]));
lastAng += radians(angs[i]);
}
If someone can how me how to alter this to draw a full-circle divided prportionally between the string values I might be able to get my own working, cheers L.