def segment(self, value, color='blue'): """return HTML string for a bar segment given a magnitude and color. """ if value <= 0: return "" else: return str(Image(self.barfiles[color], width=self.pixels(value), height=13, alt=value) )
def gen_bar(self, value, color='blue'): """return Image object for the scaled bar graphic """ if value <= 0: return "" else: bar = Image(self.barfiles[color], width=self.pixels(value), height=13, alt=value) return bar
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 gen_legend(self): """Return an HTML string which displays the legend for the chart. """ sample = Image(self.barfiles['blue'], height=13, width=40) return '<b>^%7.1f</b> lower bound<br> SCALE: %s = %7.1f units' % \ (self.zero, sample, self.scale * 40)