def makeOpenContextGraph(writer, todos): openTodos = parser.groupByContext(parser.filter(todos, doneOn=None)) openSegments = {} for k, v in openTodos.iteritems(): openSegments[k] = [len(v),] openSegments = list(openSegments.iteritems()) openSegments.sort() writeStylesheetPI(writer) writer(ET.tostring(segmentedBarGraph(openSegments, width=calcBarGraphWidth(len(openTodos)))))
def calcOpenContextWidth(todos): return calcBarGraphWidth(len(parser.groupByContext(parser.filter(todos, doneOn=None))))