web/views/plots.py
branchstable
changeset 3714 3cb7dcd9ae77
parent 3689 deb13e88e037
child 3720 5376aaadd16b
child 3785 78909a156011
equal deleted inserted replaced
3713:a090324efefe 3714:3cb7dcd9ae77
   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'})