web/views/plots.py
changeset 10688 fa29f3628a1b
parent 10669 155c29e0ed1c
equal deleted inserted replaced
10687:d394bfcd8c25 10688:fa29f3628a1b
    18 """basic plot views"""
    18 """basic plot views"""
    19 
    19 
    20 __docformat__ = "restructuredtext en"
    20 __docformat__ = "restructuredtext en"
    21 from cubicweb import _
    21 from cubicweb import _
    22 
    22 
       
    23 from six import add_metaclass
    23 from six.moves import range
    24 from six.moves import range
    24 
    25 
    25 from logilab.common.date import datetime2ticks
    26 from logilab.common.date import datetime2ticks
    26 from logilab.common.deprecation import class_deprecated
    27 from logilab.common.deprecation import class_deprecated
    27 from logilab.common.registry import objectify_predicate
    28 from logilab.common.registry import objectify_predicate
    83             return self._stream.getvalue()
    84             return self._stream.getvalue()
    84 
    85 
    85     def _render(self, *args, **kwargs):
    86     def _render(self, *args, **kwargs):
    86         raise NotImplementedError
    87         raise NotImplementedError
    87 
    88 
       
    89 
       
    90 @add_metaclass(class_deprecated)
    88 class FlotPlotWidget(PlotWidget):
    91 class FlotPlotWidget(PlotWidget):
    89     """PlotRenderer widget using Flot"""
    92     """PlotRenderer widget using Flot"""
    90     __metaclass__ = class_deprecated
       
    91     __deprecation_warning__ = '[3.14] cubicweb.web.views.plots module is deprecated, use the jqplot cube instead'
    93     __deprecation_warning__ = '[3.14] cubicweb.web.views.plots module is deprecated, use the jqplot cube instead'
    92     onload = u"""
    94     onload = u"""
    93 var fig = jQuery('#%(figid)s');
    95 var fig = jQuery('#%(figid)s');
    94 if (fig.attr('cubicweb:type') != 'prepared-plot') {
    96 if (fig.attr('cubicweb:type') != 'prepared-plot') {
    95     %(plotdefs)s
    97     %(plotdefs)s
   137                                      'plotdata': ','.join(plotdata),
   139                                      'plotdata': ','.join(plotdata),
   138                                      'mode': self.timemode and "'time'" or 'null',
   140                                      'mode': self.timemode and "'time'" or 'null',
   139                                      'dateformat': '"%s"' % fmt})
   141                                      'dateformat': '"%s"' % fmt})
   140 
   142 
   141 
   143 
       
   144 @add_metaclass(class_deprecated)
   142 class PlotView(baseviews.AnyRsetView):
   145 class PlotView(baseviews.AnyRsetView):
   143     __metaclass__ = class_deprecated
       
   144     __deprecation_warning__ = '[3.14] cubicweb.web.views.plots module is deprecated, use the jqplot cube instead'
   146     __deprecation_warning__ = '[3.14] cubicweb.web.views.plots module is deprecated, use the jqplot cube instead'
   145     __regid__ = 'plot'
   147     __regid__ = 'plot'
   146     title = _('generic plot')
   148     title = _('generic plot')
   147     __select__ = multi_columns_rset() & all_columns_are_numbers()
   149     __select__ = multi_columns_rset() & all_columns_are_numbers()
   148     timemode = False
   150     timemode = False