web/views/plots.py
changeset 3408 c92170fca813
parent 3338 cd137d90f896
child 3451 6b46d73823f5
equal deleted inserted replaced
3407:da9cc8cc7c5f 3408:c92170fca813
   119                                      'plotdata': ','.join(plotdata),
   119                                      'plotdata': ','.join(plotdata),
   120                                      'mode': self.timemode and "'time'" or 'null'})
   120                                      'mode': self.timemode and "'time'" or 'null'})
   121 
   121 
   122 
   122 
   123 class PlotView(baseviews.AnyRsetView):
   123 class PlotView(baseviews.AnyRsetView):
   124     id = 'plot'
   124     __regid__ = 'plot'
   125     title = _('generic plot')
   125     title = _('generic plot')
   126     __select__ = at_least_two_columns() & all_columns_are_numbers()
   126     __select__ = at_least_two_columns() & all_columns_are_numbers()
   127     timemode = False
   127     timemode = False
   128 
   128 
   129     def call(self, width=500, height=400):
   129     def call(self, width=500, height=400):
   168             if self.title:
   168             if self.title:
   169                 piechart.title(self.title)
   169                 piechart.title(self.title)
   170             self.w(u'<img src="%s" />' % xml_escape(piechart.url))
   170             self.w(u'<img src="%s" />' % xml_escape(piechart.url))
   171 
   171 
   172     class PieChartView(baseviews.AnyRsetView):
   172     class PieChartView(baseviews.AnyRsetView):
   173         id = 'piechart'
   173         __regid__ = 'piechart'
   174         pieclass = Pie
   174         pieclass = Pie
   175 
   175 
   176         __select__ = at_least_two_columns() & second_column_is_number()
   176         __select__ = at_least_two_columns() & second_column_is_number()
   177 
   177 
   178         def _guess_vid(self, row):
   178         def _guess_vid(self, row):
   197                 height = height or width
   197                 height = height or width
   198             pie.render(width, height, w=self.w)
   198             pie.render(width, height, w=self.w)
   199 
   199 
   200 
   200 
   201     class PieChart3DView(PieChartView):
   201     class PieChart3DView(PieChartView):
   202         id = 'piechart3D'
   202         __regid__ = 'piechart3D'
   203         pieclass = Pie3D
   203         pieclass = Pie3D