Files
odoo_source/openerp/pychart/category_coord.py
T
Vo Minh Thu f8572e5c60 [IMP] openerp python module.
- Some logging code moved from netsvc.py to loglevels.py
- Changed imports to use the new openerp module
- config and netsvc initialization calls move to openerp-server.py
- Moved openerp-server.py outside the old bin directory
- Some imports in tools moved inside the methods to break mutual-dependencies

bzr revid: vmt@openerp.com-20110207125723-ooee7d7ng5elmkso
2011-02-07 13:57:23 +01:00

49 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
#
# Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
#
# Jockey is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version.
#
# Jockey is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
import coord
import canvas
class T(coord.T):
def __init__(self, data, col):
"""This attribute is meaningful only when x_coord_system ==
'category'. This attribute selects the column of
'x_category_data' from which X values are computed.
Meaningful only when x_coord_system == 'category'. This
attribute specifies the data-set from which the X values are
extracted. See also x_category_col."""
self.data = data
self.col = col
def get_canvas_pos(self, size, val, min, max):
i = 0.5
for v in self.data:
if v[self.col] == val:
return size * i / float(len(self.data))
i += 1
# the drawing area is clipped. So negative offset will make this plot
# invisible.
return canvas.invalid_coord;
def get_tics(self, min, max, interval):
tics = []
if interval == None: interval = 1
for i in range(0, len(self.data), interval):
tics.append(self.data[i][self.col])
return tics
#return map(lambda pair, self = self: pair[self.col], self.data)