def _gen_Bar(data): vlabels = ['0'] def _average_files(gdata): return len(gdata[2]) / gdata[1] data.sort(key=lambda d: d[1], reverse=True) data = data[:10] bars = [[k[3], _average_files(k)] for k in data] labels = [k[0] for k in data] vlabels.extend([str(d[0]) for d in bars]) vlabels = [f for f in vlabels if int(f)] vlabels.sort(key=lambda t: int(t)) vlabels = ['0', vlabels[-1]] CairoPlot.bar_plot(filename, bars, width, height, border=10, grid=True, h_labels=labels, v_labels=vlabels)
def _gen_Bar(r): data = {} labels = [] bars = [] for k,g in itertools.groupby(r, lambda t: (t['committer_timeofday'].split(':')[0], t)): hour = k[0] if not data.get(hour): data[hour] = 0 data[hour] += 1 data = [(k,v) for k,v in data.iteritems()] data.sort(key=lambda d: d[0]) upper = 0 for k,v in data: if v > upper: upper = v bars.append(v) labels.append(k) vlabels = ['0', str(upper)] CairoPlot.bar_plot(filename, bars, width, height, border=10, grid=True, h_labels=labels, v_labels=vlabels)
def _gen_Donut(t): data = dict([(t[i][0], t[i][1]) for i in xrange(len(t))]) CairoPlot.donut_plot(filename, data, width, height, gradient=True, shadow=True)
def _gen_Pie(t): data = dict([(t[i][0], t[i][1]) for i in xrange(len(t))]) CairoPlot.pie_plot(filename, data, width, height, gradient=True)
def _gen_Bar(t): data = [c[1] for c in t] labels = [c[0] for c in t] vlabels = ['0', str(data[0])] CairoPlot.bar_plot(filename, data, width, height, border=10, grid=True, h_labels=labels, v_labels=vlabels)