I am still trying to work on this, but I can't seem to figure out exactly what I should change to insert my variables into. I tied it and there was a syntax error, and then I tried to define a couple of things and it got totally messed up. Anyway, what I ried doing was putting my four variables into the part that says "DATA 21, 7" or something like that.... I entered "DATA a" so that the data included would mutate into my data variables. What I am trying to do is fluctuate this grapgh so that, according to the number of responses to a specific answer in my survey, that the chart will show the difference according to the their answers. So, I designed my program to represent their data by;a(if they choose answer A),b(if they choose answer b), c, and d. If you could just insert this in that there program that would be all the help that I would need for a while.
Next time, post in the same topic again k? Alright, I fixed it up for ya... it'll prompt for the 4 variables and colors as per your request.
Code:
DIM Angle(1)
DIM MyData(0 TO 4)
DIM C(1 TO 4)
Pi = 4 * ATN(1) ' Can use 3.141593
Radius = 200 ' Change these to suit your taste
Xc = 319 ' x coordinate of center of circle
Yc = 239 ' y coordinate of center of circle
FOR i = 1 TO 4
PRINT "Value "; i;
INPUT MyData(i)
MyData(0) = MyData(0) + MyData(i)
PRINT "Color "; i;
INPUT C(i)
NEXT
SCREEN 12 ' graphics mode with ok resolution
Angle(0) = 0 ' Set initial angle
FOR i = 1 TO 4
IF i = 4 THEN ' Set final angle of wedge
Angle(1) = 2 * Pi
ELSE
Angle(1) = Angle(0) + 2 * Pi * MyData(i) / MyData(0)
END IF
FOR j = 0 TO 1 ''' Draw sides of wedges. Neg sign on Radius because CIRCLE flips y coordinates
LINE (Xc, Yc)-STEP(Radius * COS(Angle(j)), -Radius * SIN(Angle(j))), C(i)
NEXT
CIRCLE (Xc, Yc), Radius, C(i), Angle(0), Angle(1) ' Draw arc
AvgAngle = (Angle(1) + Angle(0)) / 2 ' find middle of wedge and paint
PAINT (Xc + Radius * COS(AvgAngle) / 2, Yc - Radius * SIN(AvgAngle) / 2), C(i)
Angle(0) = Angle(1) ' update initial angle
NEXT