/usr/share/pyshared/pychart/category_coord.py is in python-pychart 1.39-7build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #
# 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)
|