Grid
index
/Users/amos/Documents/Database/Mental/Programming/python/lib/avatar/Personal2/www.amos/Python/lib/mathlib/FiniteSeries/Graph/Grid.py

Implement the Grid class for Graph.py.

 
Classes
       
Grid
Round125Grid

 
class Grid
    Grid instance embodies the list of coordinates at which gridlines will be drawn across the graph.
 
To use this base class, pass a specific list to the constructor, alongside the data. Then the gridlines will be drawn at those coordinates. Subclasses of Grid implement algorithms for calculating the grid based on the data, if the client doesn't want to specify the grid explicitly. 
 
Both Axes in a graph will have a Grid instance. A Grid instance with an empty list of coordinates means no grid will be drawn. You may want no grid for sparklines, or a minimalist style.
 
  Methods defined here:
__init__(self, ldxData, lxGrid=None)
__str__(self)
a compact string representation useful for debugging
getDataExtremes(self)
Recall the stored extreme values of the data.
getExtremes(self)
Recall the stored extreme values of the grid.
getGrid(self)
getMax(self)
getMin(self)
getRange(self)
setDataExtremes(self, ldxData)
Find and store the extreme values of the data.
 
If you use the Grid class explicitly, calculating your own grid, the DataExtremes methods will not be called. But they are here because many of the subclasses will need them.
setExtremes(self, isDataIn=False)
Find and store the extreme values of the grid, optionally including the extreme values of the data.
 
Pass isDataIn = False (the default) to truncate the graph at the grid extremes, even if the data goes beyond them.
 
Pass isDataIn = True to extend the graph to include all the data. This condition will be forced if only one grid line is to be drawn, to avoid a grid with a range of zero.
setGrid(self, lxGrid)

 
class Round125Grid(Grid)
    This Grid will give you a number of equally-spaced lines at round numbers across your data range.
 
  Methods defined here:
MakeGrid(self, xMin)
The common distance between adjacent grid lines (xGrid) is 1, 2, or 5 times a power of 10: the maximum such number that will allow at least the requested number of grid lines.
 
How many actual gridlines do you get, based on the data and the requested number? It's complicated. But the actual number will always be greater than or equal to the requested number. The proof is outlined in the source code comments.
__init__(self, ldxData, cMin=2)
Specify a minimum number of gridlines in the second argument (cMin), and the grid will have that many, or a few more. 
 
If what you get is too many, you can reduce the minimal "count" fractionally, so that in a given instance, cMin == 2 might give you 4 gridlines, cMin == 1.8 give you 3, and cMin == 1.5 give you 2.

Methods inherited from Grid:
__str__(self)
a compact string representation useful for debugging
getDataExtremes(self)
Recall the stored extreme values of the data.
getExtremes(self)
Recall the stored extreme values of the grid.
getGrid(self)
getMax(self)
getMin(self)
getRange(self)
setDataExtremes(self, ldxData)
Find and store the extreme values of the data.
 
If you use the Grid class explicitly, calculating your own grid, the DataExtremes methods will not be called. But they are here because many of the subclasses will need them.
setExtremes(self, isDataIn=False)
Find and store the extreme values of the grid, optionally including the extreme values of the data.
 
Pass isDataIn = False (the default) to truncate the graph at the grid extremes, even if the data goes beyond them.
 
Pass isDataIn = True to extend the graph to include all the data. This condition will be forced if only one grid line is to be drawn, to avoid a grid with a range of zero.
setGrid(self, lxGrid)

 
Functions
       
add(...)
add(a, b) -- Same as a + b.
ceil(...)
ceil(x)
 
Return the ceiling of x as a float.
This is the smallest integral value >= x.
floor(...)
floor(x)
 
Return the floor of x as a float.
This is the largest integral value <= x.
log(...)
log(x[, base]) -> the logarithm of x to the given base.
If the base not specified, returns the natural logarithm (base e) of x.