Pie Chart Algorithms?

Sivakatirswami katir at hindu.org
Tue Feb 28 16:29:53 EST 2006


OK, was musing to make a simple pie chart: make a circle and set up  
the center point as a fixed variable and the point on the circle as  
the dynamic variable and draw radius lines programatically: seems  
simple enough.. but:

1) draw circle graphic with shift key down to constrain to perfect  
circle
2) name it "oval1"
3) msg box: put the points of grc "oval1"

result: nothing

I'm missing something... Where to go from here? Obvious algorithms  
needed:

1) draw radius vectors e.g.

-- set the divisions to 10% (of the circle); draw nine vectors (where  
there are ten equal divisions) 
-- set initial vector to vertical (center to point 1 where point one  
is the exact top of the circle
-- add second vector at 30% off the circle (another line draw 30  
degrees off from the above radius )

2) fill resulting sectors (by script) with a color
3) find some point equidistant from the three points of a sector (for  
dropping in a label field programatically)

That's as far as I could "see" I sure others have invented this wheel  
a long time ago... my trigonometry is  a bit too weak for me to  
actually start writing the code from ground zero, but I could  
probably "get it" if I saw some basic scripts.

Meanwhile I'm off to dig the doc for related syntax.

Sivakatirswami





More information about the use-livecode mailing list