1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
31 @objectify_selector |
31 @objectify_selector |
32 def all_columns_are_numbers(cls, req, rset=None, *args, **kwargs): |
32 def all_columns_are_numbers(cls, req, rset=None, *args, **kwargs): |
33 """accept result set with at least one line and two columns of result |
33 """accept result set with at least one line and two columns of result |
34 all columns after second must be of numerical types""" |
34 all columns after second must be of numerical types""" |
35 for etype in rset.description[0]: |
35 for etype in rset.description[0]: |
36 if etype not in ('Int', 'Float'): |
36 if etype not in ('Int', 'BigInt', 'Float'): |
37 return 0 |
37 return 0 |
38 return 1 |
38 return 1 |
39 |
39 |
40 @objectify_selector |
40 @objectify_selector |
41 def second_column_is_number(cls, req, rset=None, *args, **kwargs): |
41 def second_column_is_number(cls, req, rset=None, *args, **kwargs): |
42 etype = rset.description[0][1] |
42 etype = rset.description[0][1] |
43 if etype not in ('Int', 'Float'): |
43 if etype not in ('Int', 'BigInt', 'Float'): |
44 return 0 |
44 return 0 |
45 return 1 |
45 return 1 |
46 |
46 |
47 @objectify_selector |
47 @objectify_selector |
48 def columns_are_date_then_numbers(cls, req, rset=None, *args, **kwargs): |
48 def columns_are_date_then_numbers(cls, req, rset=None, *args, **kwargs): |
49 etypes = rset.description[0] |
49 etypes = rset.description[0] |
50 if etypes[0] not in ('Date', 'Datetime', 'TZDatetime'): |
50 if etypes[0] not in ('Date', 'Datetime', 'TZDatetime'): |
51 return 0 |
51 return 0 |
52 for etype in etypes[1:]: |
52 for etype in etypes[1:]: |
53 if etype not in ('Int', 'Float'): |
53 if etype not in ('Int', 'BigInt', 'Float'): |
54 return 0 |
54 return 0 |
55 return 1 |
55 return 1 |
56 |
56 |
57 |
57 |
58 def filterout_nulls(abscissa, plot): |
58 def filterout_nulls(abscissa, plot): |