module timelinelib.canvas.drawing.drawers.legenddrawer

Contains the LegendDrawer class. Tests are defined Here.

timelinelib.canvas.drawing.drawers.legenddrawer.IP = 3
timelinelib.canvas.drawing.drawers.legenddrawer.OP = 5
timelinelib.canvas.drawing.drawers.legenddrawer.BOTTOM_LEFT = 0

Default value.

timelinelib.canvas.drawing.drawers.legenddrawer.TOP_LEFT = 1

.

timelinelib.canvas.drawing.drawers.legenddrawer.TOP_RIGHT = 2

.

timelinelib.canvas.drawing.drawers.legenddrawer.BOTTOM_RIGHT = 3

.

class timelinelib.canvas.drawing.drawers.legenddrawer.LegendDrawer[source]

Bases: object

The legend is a box containing one item row for each category displayed in a timeline. An item contains a text and colored box. The text is the category text and the color is the color of the category. The legend box can be placed at different locations on the Teimeline panel. When measures are calculated it’s assumed that it will be placed in the upper left corner:

                            OP
 IP                        |  | 
|  |              >|   |< text_height
+--------------------------+---
|                          |    IP
|                  +---+   |---
|   Xxxxxxx yyyy   |   |   |
|                  +---+   |---
|                          |    IP
|                  +---+   |---
|   Xxxxxxx yyyy   |   |   |    text_height
|                  +---+   |---
|   |          |     :     |
|    text_width      :     |
|                    :     |
+--------------------------+
                |  |    |  |
                 OP      IP
__init__(dc, scene, categories)[source]

Initialize self. See help(type(self)) for accurate signature.

draw()[source]

Draw the legend on the Timeline panel.

timelinelib.canvas.drawing.drawers.legenddrawer.color_box(tw, th, y, category)[source]