[MERGE] latest trunk
[odoo/odoo.git] / openerp / pychart / coord.py
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
4
5 # Jockey is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2, or (at your option) any
8 # later version.
9 #
10 # Jockey is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 # for more details.
14 #
15 class T(object):
16     def get_canvas_pos(self, size, val, min, max):
17         """
18         Compute the screen location at which a sample value would be drawn.
19         ``size`` is the width or height of the chart, in points.
20         ``val`` is the sample value.
21         ``min`` and ``max`` are the minimum and maximum sample values that
22         are to be displayed over the length of ``size``.
23
24         For example, suppose the width of a chart is 200 points and the
25         minimum and maximum X values in the sample data are 100 and 150
26         respectively. When Pychart wants to draw a sample point at the X
27         value of 120, it will call
28         area.T.x_coord.get_canvas_pos(size = 200, val = 120, min = 100, max = 150).
29         """
30         raise Exception
31     
32     def get_tics(self, min, max, interval):
33         """Generate the list of places for drawing tick marks."""
34         raise Exception
35     
36     def get_min_max(self, min, max, interval):
37         """Compute the min/max values to be displayed in the chart.
38         Parameters ``min`` and ``max`` are the minimum and maximum values
39         of the sample data passed to the plots. Parameter ``interval`` is
40         the value of attribute area.T.x_grid_interval (or y_grid_interval).
41         It is None if these attributes are non-specified.
42
43         This method must return tuple (dmin, dmax, dinterval).
44         dmin should be ``min`` rounded down to some good number.
45         dmax should be ``max`` rounded up to some good number.
46         dinterval should be ``interval`` if it is non-None. Otherwise, the
47         method must compute some good value.
48         """
49         
50         raise Exception