21.3 Drawing other objects on canvas
Description: Drawing other objects on canvas
Keywords: pychart

##
21.3 Drawing other objects on canvas

The objects of `canvas.T` class and its subclasses provides several methods that can be invoked manually to draw variety of things if you desire so.

`line`( | linestyle, x1, y1, x2, y2)

      # draw a line segment from (10,20) to (100, 200)
      can.line(line_style.blackdash1, 10, 20, 100, 200)

`polygon`( | linestyle, fillstyle, [(x1,y1), ..., (xn, yn)])

  Draw a polygon with linestyle ( see Section 14), fill with fillstyle (see Section 16), and the edges points. Parameter points is a list of coordinates, e.g., ((10,10), (15,5), (20,8)). Value of linestyle can be None, in which case no perimeter lines are drawn. Value of fillstyle can also be None, in which the internal of the polygon are left undrawn. Parameter shadow is either None or tuple (xdelta, ydelta, shadowstyle). If non-None, a shadow of shadowstyle (see Section 16) is drawn beneath the polygon at the offset of (xdelta, ydelta).

      can.polygon(line_style.default, fill_style.default,
                     [(10, 20), (100, 200), (300,300)])

`rectangle`( | linestyle, fillstyle, x1, y1, x2, y2, shadow=None)

  Parameter shadow is either None or tuple (xdelta, ydelta, shadowstyle). If non-None, a shadow of shadowstyle ( see Section 16) is drawn beneath the polygon at the offset of (xdelta, ydelta).

      can.rectangle(line_style.default, fill_style.default, 10, 20, 300, 300)

`ellipsis`( | linestyle, fillstyle, x, y, radius, y_elongation=1, start=0, end=360, shadow=None)

  The start and end angles are specified in degrees; i.e., between 0 and 360. Parameter shadow is either None or tuple (xdelta, ydelta, shadowstyle). If non-None, a shadow of shadowstyle ( see Section 16) is drawn beneath the polygon at the offset of (xdelta, ydelta).

`round_rectangle`( | linestyle, fillstyle, x1, y2, x2, y2, radius, shadow=None)

  Draw a rectangle with rounded four corners. Parameter radius specifies the radius of each corner.

  Parameter shadow is either None or tuple (xdelta, ydelta, shadowstyle). If non-None, a shadow of shadowstyle ( see Section 16) is drawn beneath the polygon at the offset of (xdelta, ydelta).

`curve`( | linestyle, [(x1,y2), ..., (xn, yn)])

  Draw a Bezier curve.

`show`( | x, y, text)

  Parameter text supports font manipulation, as defined in See Section 17.

`verbatim`( | str)

  This procedure outputs an arbitrary text STR to the file.