~openerp-commiter/openobject-client/6.0-opw-382021-nch

« back to all changes in this revision

Viewing changes to bin/tinygraph/__init__.py

  • Committer: Naresh(OpenERP)
  • Date: 2012-02-14 06:22:48 UTC
  • Revision ID: nch@tinyerp.com-20120214062248-w4i26wrckrw0p8jl
[IMP]:sorting on selection field based on key and in order they are defined in the class

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    return []
36
36
 
37
37
 
38
 
def tinygraph(subplot, type='pie', axis={}, axis_data={}, datas=[], axis_group_field={}, orientation='horizontal', overlap=1.0):
 
38
def tinygraph(subplot, type='pie', axis={}, axis_data={}, datas=[], axis_group_field={}, selection_values=False, orientation='horizontal', overlap=1.0):
39
39
    subplot.clear()
40
40
    operators = {
41
41
        '+': lambda x,y: x+y,
64
64
            else:
65
65
                data_all[d[axis[0]]][group_eval] = d[field]
66
66
        data_axis.append(data_all)
67
 
 
68
67
    axis_group = axis_group.keys()
69
68
    axis_group.sort()
70
69
    axis_lable = dic_lable.keys()
71
70
    axis_lable.sort()
 
71
    if axis_type == 'selection' and selection_values:
 
72
        axis_lable = [y for x, y in selection_values if y in axis_lable]
 
73
   
72
74
 
73
75
    tmp = {}
74
76
    except_tmp = []