Browse Source

Now import the modules into the SVG namespace.

Began adding support to Plot to support maximum x & y values, but this currently doesn't work as the axis labels don't get generated correctly with this method.
pull/8/head
SANDIA\jaraco 19 years ago
parent
commit
3a851f26b4
  1. 8
      Plot.py
  2. 3
      __init__.py

8
Plot.py

@ -119,6 +119,11 @@ class Plot( SVG.Graph ):
min_x_value = None min_x_value = None
"Set the minimum value of the Y axis" "Set the minimum value of the Y axis"
min_y_value = None min_y_value = None
"Set the maximum value of the X axis"
max_x_value = None
"Set the maximum value of the Y axis"
max_y_value = None
stacked = False stacked = False
@apply @apply
@ -160,6 +165,9 @@ class Plot( SVG.Graph ):
side = { 'x': 'right', 'y': 'top' }[axis] side = { 'x': 'right', 'y': 'top' }[axis]
data_index = getattr( self, '%s_data_index' % axis ) data_index = getattr( self, '%s_data_index' % axis )
max_value = max( map( lambda set: max( set['data'][data_index] ), self.data ) ) max_value = max( map( lambda set: max( set['data'][data_index] ), self.data ) )
spec_max = getattr( self, 'max_%s_value' % axis )
if spec_max is not None:
max_value = max( max_value, spec_max )
min_value = min( map( lambda set: min( set['data'][data_index] ), self.data ) ) min_value = min( map( lambda set: min( set['data'][data_index] ), self.data ) )
spec_min = getattr( self, 'min_%s_value' % axis ) spec_min = getattr( self, 'min_%s_value' % axis )
if spec_min is not None: if spec_min is not None:

3
__init__.py

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
__all__ = ( 'Plot', 'TimeSeries' ) __all__ = ( 'Plot', 'TimeSeries' )
from xml.dom import minidom as dom from xml.dom import minidom as dom
from operator import itemgetter from operator import itemgetter
from itertools import islice from itertools import islice
@ -703,3 +704,5 @@ class class_dict( object ):
def keys( self ): def keys( self ):
# dir returns a good guess of what attributes might be available # dir returns a good guess of what attributes might be available
return dir( self.__obj__ ) return dir( self.__obj__ )
import Plot, TimeSeries
Loading…
Cancel
Save