def gen_legend(self): """Return an HTML string which displays the legend for the chart. """ s = [] for i in range(len(self.datalist.segment_names)): s.append( str(Image(self.barfiles[self.colors[i]], height=13, width=30))) s.append(str(Font(self.datalist.segment_names[i], size=-1))) s.append(" ") return string.join(s, ' ')
def __init__(self, year=1997, month=1): SimpleDocument.__init__(self, bgcolor = PAGECOLOR) self.year = year self.month = month self.monthname = month_name[month] self.title = self.monthname + ' ' + str(self.year) self.ndays = mdays[month] now = time.strftime("%c", time.localtime(time.time())) self.append( '<P>', Font("Updated " + now, size = -1) ) self.append( Center( H(3,self.title) ) ) self.datetable = DateTable(cellpadding=6, cellspacing=2, border=3) self.jumper = '' for i in range(1, self.ndays+1): self.jumper = self.jumper + str(Href('#'+`month`+'-'+`i`, `i`)) + ' ' self.datetable.append(Day(self.year, self.month, i)) self.append( Center(self.jumper, html_escape='off') ) self.append('<P>') self.append( self.datetable )
def __str__(self): return "%s %s" % (Font(self.hr + ':' + self.min, size=-1, color=TIMECOLOR), Font(self.text, size=-1))