~hazmat/launchpad-work-items-tracker/cdo-austin

« back to all changes in this revision

Viewing changes to burndown-chart

  • Committer: Martin Pitt
  • Date: 2010-01-17 18:31:24 UTC
  • Revision ID: martin.pitt@canonical.com-20100117183124-jok9mjnrbtiuiogl
burndown-chart: show both team-only and foreign counts

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        count = i.get('done', 0) + i.get('todo', 0) + i.get('postponed', 0)
47
47
        if max_items < count:
48
48
            max_items = count
49
 
        pcdata.append((date, i.get('todo', 0), i.get('done', 0), i.get('postponed', 0), count))
 
49
        pcdata.append((date, i.get('todo_teamonly', 0), i.get('todo', 0),
 
50
            i.get('done_teamonly', 0), i.get('done', 0), 
 
51
            i.get('postponed_teamonly', 0), i.get('postponed', 0), count))
50
52
 
51
53
    # add some extra space to look nicer
52
54
    max_items = int(max_items * 1.05)
81
83
    # for each column of data, tell it what to use for the legend and
82
84
    # what color to make the bar, no lines, and
83
85
    # what plot to stack on
84
 
    plot1 = bar_plot.T(label='todo', hcol=1)
85
 
    plot1.fill_style = fill_style.red
 
86
    plot1 = bar_plot.T(label='todo (team)', hcol=1)
 
87
    plot1.fill_style = fill_style.Plain(bgcolor=color.red)
86
88
    plot1.line_style = None
87
 
    plot2 = bar_plot.T(label='done', hcol=2, stack_on = plot1)
88
 
    plot2.fill_style = fill_style.green
 
89
    plot2 = bar_plot.T(label='todo (foreign)', hcol=2)
 
90
    plot2.fill_style = fill_style.Plain(bgcolor=color.coral1)
89
91
    plot2.line_style = None
90
 
    plot3 = bar_plot.T(label="postponed", hcol=3, stack_on = plot2)
91
 
    plot3.fill_style = fill_style.yellow
 
92
 
 
93
    plot3 = bar_plot.T(label='done (team)', hcol=3, stack_on = plot2)
 
94
    plot3.fill_style = fill_style.green
92
95
    plot3.line_style = None
93
 
    plot4 = bar_plot.T(label='total', hcol=4)
94
 
    plot4.fill_style = None
95
 
    plot4.line_style = line_style.gray30
 
96
    plot4 = bar_plot.T(label='done (foreign)', hcol=4, stack_on = plot2)
 
97
    plot4.fill_style = fill_style.Plain(bgcolor=color.olivedrab1)
 
98
    plot4.line_style = None
 
99
 
 
100
    plot5 = bar_plot.T(label="postponed (team)", hcol=5, stack_on = plot4)
 
101
    plot5.fill_style = fill_style.Plain(bgcolor=color.yellow2)
 
102
    plot5.line_style = None
 
103
    plot6 = bar_plot.T(label="postponed (foreign)  ", hcol=6, stack_on = plot4)
 
104
    plot6.fill_style = fill_style.Plain(bgcolor=color.yellow1)
 
105
    plot6.line_style = None
 
106
 
 
107
    plot7 = bar_plot.T(label='total', hcol=7)
 
108
    plot7.fill_style = None
 
109
    plot7.line_style = line_style.gray30
96
110
 
97
111
    # create the canvas with the specified filename and file format
98
112
    can = canvas.init(filename,format)
99
113
 
100
114
    # add the data to the area and  draw it
101
 
    ar.add_plot(plot1, plot2, plot3, plot4)
 
115
    ar.add_plot(plot2, plot1, plot4, plot3, plot6, plot5, plot7)
102
116
    ar.draw()
103
117
 
104
118
    # create and arrow for the trend line
110
124
 
111
125
    # set up the trend line position and draw it
112
126
    if not trend_start:
113
 
        trend_start = pcdata[0][1]
 
127
        trend_start = pcdata[0][2]
114
128
    trend_line.draw([(0, ar.y_pos(trend_start)), (ar.x_pos(date_to_ordinal(end_date)), 0)])
115
129
 
116
130
    # title