web/views/plots.py
changeset 3720 5376aaadd16b
parent 3451 6b46d73823f5
parent 3714 3cb7dcd9ae77
child 3890 d7a270f50f54
equal deleted inserted replaced
3678:29f74716fd70 3720:5376aaadd16b
   110         self.w(u'<div id="%s" style="width: %spx; height: %spx;"></div>' %
   110         self.w(u'<div id="%s" style="width: %spx; height: %spx;"></div>' %
   111                (figid, width, height))
   111                (figid, width, height))
   112         for idx, (label, plot) in enumerate(zip(self.labels, self.plots)):
   112         for idx, (label, plot) in enumerate(zip(self.labels, self.plots)):
   113             plotid = '%s_%s' % (figid, idx)
   113             plotid = '%s_%s' % (figid, idx)
   114             plotdefs.append('var %s = %s;' % (plotid, self.dump_plot(plot)))
   114             plotdefs.append('var %s = %s;' % (plotid, self.dump_plot(plot)))
   115             plotdata.append("{label: '%s', data: %s}" % (label, plotid))
   115             # XXX ugly but required in order to not crash my demo
       
   116             plotdata.append("{label: '%s', data: %s}" % (label.replace(u'&', u''), plotid))
   116         req.html_headers.add_onload(self.onload %
   117         req.html_headers.add_onload(self.onload %
   117                                     {'plotdefs': '\n'.join(plotdefs),
   118                                     {'plotdefs': '\n'.join(plotdefs),
   118                                      'figid': figid,
   119                                      'figid': figid,
   119                                      'plotdata': ','.join(plotdata),
   120                                      'plotdata': ','.join(plotdata),
   120                                      'mode': self.timemode and "'time'" or 'null'})
   121                                      'mode': self.timemode and "'time'" or 'null'})
   175 
   176 
   176         __select__ = at_least_two_columns() & second_column_is_number()
   177         __select__ = at_least_two_columns() & second_column_is_number()
   177 
   178 
   178         def _guess_vid(self, row):
   179         def _guess_vid(self, row):
   179             etype = self.cw_rset.description[row][0]
   180             etype = self.cw_rset.description[row][0]
   180             if self._cw.schema.eschema(etype).is_final():
   181             if self._cw.schema.eschema(etype).final:
   181                 return 'final'
   182                 return 'final'
   182             return 'textincontext'
   183             return 'textincontext'
   183 
   184 
   184         def call(self, title=None, width=None, height=None):
   185         def call(self, title=None, width=None, height=None):
   185             labels = []
   186             labels = []