Circle Object
Parents Children Properties Methods Events
Purpose: A Graphical object to draw circles, arcs, and pie-slices.

Description

The Points property contains the co-ordinates of the centre of the circle. The size of the circle is determined by the Radius property. This specifies the radius along the x-axis, the height is calculated so that the object is circular.

The RadiusMode property determines whether or not the circle is adjusted by a pixel, if required in order to appear perfectly round and perfectly centred. The default value is 0 (no adjustment is made).

The Start and/or End properties are used to draw partial circles. They specify start and end angles respectively, measuring from the x-axis in a counter-clockwise direction and are expressed in radians. The type of arc is controlled by ArcMode as follows :

ArcMode Effect

0 An arc is drawn from Start to End.
1 An arc is drawn from Start to End. In addition, a single straight line is drawn from one end of the arc to the other, resulting in a segment.
2 An arc is drawn from Start to End. In addition, two lines are drawn from each end of the arc to the centre, resulting in a pie-slice

.

Points, Radius, Start and End can specify vectors so that several arcs, circles, pie slices, etc. can be drawn in one call (and with one name).

If Start is specified, but not End, end angles default to (¯1↓+\Start),○2. If End is specified, but not Start, start angles default to 0,¯1↓+\End

This means that you can draw a pie-chart using either Start or End angles; you do not have to specify both.

Examples:

A circle whose centre is (50,50) and radius 20

      'g.p1' ⎕WC 'Circle' (50 50) 20

An arc

      'g.arc' ⎕WC 'Circle' (50 50) 20 ('Start' (○0.75))('End' (○1.25))

Complete pie

      Data←12 27 21 40
      ANGLES←0,¯1↓((○2)÷+/Data)×+\Data
      COLS←(255 0 0)(0 255 0)(255 255 0)(0 0 255)
      PATS←1 2 3 4
      'g.pie' ⎕WC 'Circle' (50 50) 20 ('Start' ANGLES)
                  ('ArcMode' 2) ('FCol' (⊂0 0 0))
                  ('FStyle' PATS) ('FillCol' COLS)

Same pie as above, but 2nd slice is exploded by changing its centre and 4th slice is shrunk by reducing its radius :

      CY←50 52 50 50  ⍝ y-coord of centres
      R←20 20 20 17.5 ⍝ radii
      'g.pie' ⎕WC 'Circle' (50 CY) R ('Start' ANGLES)
                  ('ArcMode' 1) ('FCol' (⊂0 0 0))
                  ('FStyle' PATS) ('FillCol' COLS)