示例#1
0
 def make_bar_cell(self, dict):
     """return a TD object containing the scaled bar
     """
     cell = TD(bgcolor=self.bar_shade, html_escape="OFF")
     cell.append(self.gen_bar(dict['value'],
                              self.color_code(dict['value'])))
     return cell
示例#2
0
 def __str__(self):
     """Generate HTML for the entire table and caption.
     """
     self.normalize()  #calculate the scaling of the data
     self.table.prepend(Caption(Bold(self.title)))  #add title as caption
     for item in self.datalist:
         row = TR()
         # 1st cell is the text description
         row.append(
             TD(item['label'],
                align='left',
                width=70,
                bgcolor=self.label_shade))
         # 2nd cell is the decimal sum value
         row.append(
             TD("%9.1f" % item['total'],
                align='right',
                width=70,
                bgcolor=self.value_shade))
         # 3rd cell contains the scaled bar graphic
         row.append(self.make_bar_cell(item))
         self.table.append(row)  # add the row to the table
     # now tack on a legend at the bottom
     self.table.append(
         TR(
             TD('AVERAGE', align='left', width=70,
                bgcolor=self.label_shade),
             TD("%9.1f" % self.average,
                align='right',
                width=70,
                bgcolor=self.value_shade),
             TD(self.gen_legend(),
                bgcolor=self.label_shade,
                html_escape="OFF")))
     return str(self.table)
示例#3
0
 def make_bar_cell(self, dict):
     """return a TD object containing the scaled bar
     """
     cell = TD(bgcolor=self.bar_shade, html_escape="OFF")
     cell.append(self.gen_bar(dict['value'],
                              self.color_code(dict['value'])))
     return cell
示例#4
0
 def make_row(self):
     if self.weekday in ('Saturday', 'Sunday'):
         row = TR(bgcolor=WEEKENDCOLOR)
     else:
         row = TR(bgcolor=WEEKDAYCOLOR)
     row.append(TD(self.repr_date_cell(), align='right', html_escape='off'))
     row.append(TD(self.repr_appt_cell(), html_escape='off'))
     return row
示例#5
0
 def make_bar_cell(self, dict):
     """return a TD object containing the scaled bar
     """
     cell = TD(bgcolor=self.bar_shade, html_escape="OFF")
     values = []
     for name in self.datalist.segment_names:
         values.append(dict[name])
     cell.append(self.gen_bar(values, self.colors))
     return cell
示例#6
0
 def make_bar_cell(self, dict):
     """return a TD object containing the scaled bar
     """
     cell = TD(bgcolor=self.bar_shade, html_escape="OFF")
     values = []
     for name in self.datalist.segment_names:
         values.append(dict[name])
     cell.append(self.gen_bar(values, self.colors))
     return cell