5.2.1 Modifing Rows


Code

class Example(gantt.Standard):
    data = acso
    show_rowlines = True
    row_attrib = "example_same_row"
    
    properties = \
    {"row.linestyle" : "dashed",
      "row.linewidth" : .5,
      "background.facecolor" : "white"
      }
     
    def modify_widget(self, widget, task):
        if task.complete >= 100: facecolor = "green"
        elif task.complete > 0 : facecolor = "orange"
        else: facecolor = "red"
        widget.row.add_artist(Circle((RIGHT-12*HSEP, VCENTER), 4 * VSEP,
                                     facecolor=facecolor))

Result

\includegraphics[width=\textwidth]{gencustomize/gantt1}

Description

With the attributes show_rowlines and properties you can controls the general apperance of rows. The linestyle group for rows is called row. For a finer control of rows you can overwrite the method modify_widget and use the row attribute of the widget. Inside the Project definition (see line 24) you can specify a special attribute to control in which row the gantt object will be displayed. The name of that attribute is specified by row_attrib.