Pie Chart
Using a different array of random numbers to the example but still equalling 360degrees the pie chart worked.
Now im entering the numbers i need it just displays a white circle with black outline.
I only have two numbers in the array and they add up to 360 so there shouldnt be a problem, also i havent altered the code at all apart from to change the array name.
Any help would be great.
Here is a snippet of the code below:
- float diameter = min(200, 200);
int[] angs = {30, 10, 45, 35, 60, 38, 75, 67};
int[] cuba = {188, 172};
float lastAng = 0;
// Displays corresponding pie chart if mouse is pressed in certain location
if(mousePressed && (mouseX > 10) && (mouseX < 30) &&
(mouseY > 10) && (mouseY < 30))
{
for (int i = 0; i < cuba.length; i++)
{
fill(cuba[i] * 3.0);
arc(300,120, diameter, diameter, lastAng, lastAng+radians(cuba[i]));
lastAng += radians(cuba[i]);
}
}