| |
- UserList.UserList(_abcoll.MutableSequence)
-
- DataList
- BarChart
-
- StackedBarChart
class BarChart |
|
Class which takes a DataList object and creates
the HTML to represent a color coded bar chart.
Values to be charted are limited to non-negative values. |
|
Methods defined here:
- __init__(self, datalist=None)
- datalist is an instance of class DataList
- __str__(self)
- Generate HTML for the entire table and caption.
- color_code(self, value)
- return a color string based on whether the given datum
falls beyond thresholds. Works off self.thresholds=(low,hi).
- gen_bar(self, value, color='blue')
- return Image object for the scaled bar graphic
- gen_legend(self)
- Return an HTML string which displays the legend for the chart.
- initialize(self)
- Initialize the chart properties.
This method is overloaded by child classes.
- make_bar_cell(self, dict)
- return a TD object containing the scaled bar
- normalize(self)
- Scale data to values between 0 and 400.
Determine peak value and set scale accordingly. If the values
are clustered within 30% of each other, will shift the zero
point for the barchart up to exagerate the value differences.
To inhibit this, set the .bound_zero attribute to "yes".
- pixels(self, magnitude)
- returns the integer number of pixels to represent a given magnitude.
Data and other attributes defined here:
- bar_shade = '#DDDDDD'
- label_shade = '#FFFFFF'
- max_width = 400
- title = ''
- value_shade = '#9999CC'
- zero = 0
|
class DataList(UserList.UserList) |
|
Class supporting tabular storage and access of data.
Used by BarChart classes. Takes a list of sequences and loads
them into a list of dictionaries using the first item from the
sequence as a label key. The column names are from the
segment_names* attribute and *must be set prior to loading
multidimensional data.
Supports some simple data processing methods. |
|
- Method resolution order:
- DataList
- UserList.UserList
- _abcoll.MutableSequence
- _abcoll.Sequence
- _abcoll.Sized
- _abcoll.Iterable
- _abcoll.Container
- __builtin__.object
Methods defined here:
- __init__(self, list=None)
- __str__(self)
- Return tabular string representation of internal data.
- add_column(self, name, pairs)
- Take list of (label,value) pairs and add the data as a
new column named name.
- cache_labels(self)
- Create cache of indexes corresponding to the labels
to speed calles to index method.
- decreasing(self, a, b)
- increasing(self, a, b)
- index(self, label)
- return dictionary corresponding to label string.
- load_tuple(self, t)
- Load individual record of data into new dictionary.
Use first item in given sequence as label key and assigns
remaining items with keys from segment_names in order.
- load_tuples(self, tt)
- Load each item from the given sequence of sequences.
- max(self, key='value')
- return maximum value in column key
- mean(self, key='value')
- return mean (average) of values in column key
- min(self, key='value')
- return minimum value in column key
- sort(self, key='label', direction='increasing')
- Sort list according to key in direction.
Example: DLobject.sort('height', 'decreasing')
- sum(self, key='value')
- return sum of values in column key
- sum_totals(self)
- add new key 'total' to each dictionary
Data and other attributes defined here:
- __abstractmethods__ = frozenset([])
- segment_names = ('value',)
Methods inherited from UserList.UserList:
- __add__(self, other)
- __cmp__(self, other)
- __contains__(self, item)
- __delitem__(self, i)
- __delslice__(self, i, j)
- __eq__(self, other)
- __ge__(self, other)
- __getitem__(self, i)
- __getslice__(self, i, j)
- __gt__(self, other)
- __iadd__(self, other)
- __imul__(self, n)
- __le__(self, other)
- __len__(self)
- __lt__(self, other)
- __mul__(self, n)
- __ne__(self, other)
- __radd__(self, other)
- __repr__(self)
- __rmul__ = __mul__(self, n)
- __setitem__(self, i, item)
- __setslice__(self, i, j, other)
- append(self, item)
- count(self, item)
- extend(self, other)
- insert(self, i, item)
- pop(self, i=-1)
- remove(self, item)
- reverse(self)
Data and other attributes inherited from UserList.UserList:
- __hash__ = None
Methods inherited from _abcoll.Sequence:
- __iter__(self)
- __reversed__(self)
Class methods inherited from _abcoll.Sized:
- __subclasshook__(cls, C) from abc.ABCMeta
Data descriptors inherited from _abcoll.Sized:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _abcoll.Sized:
- __metaclass__ = <class 'abc.ABCMeta'>
- Metaclass for defining Abstract Base Classes (ABCs).
Use this metaclass to create an ABC. An ABC can be subclassed
directly, and then acts as a mix-in class. You can also register
unrelated concrete classes (even built-in classes) and unrelated
ABCs as 'virtual subclasses' -- these and their descendants will
be considered subclasses of the registering ABC by the built-in
issubclass() function, but the registering ABC won't show up in
their MRO (Method Resolution Order) nor will method
implementations defined by the registering ABC be callable (not
even via super()).
|
class StackedBarChart(BarChart) |
|
Represent up to six data values in a stacked barchart. |
|
Methods defined here:
- gen_bar(self, values, colors)
- return HTML string for the stacked bar graphic.
- gen_legend(self)
- Return an HTML string which displays the legend for the chart.
- initialize(self)
- Define StackedBarChart specific attributes.
- make_bar_cell(self, dict)
- return a TD object containing the scaled bar
- segment(self, value, color='blue')
- return HTML string for a bar segment given a magnitude and color.
Methods inherited from BarChart:
- __init__(self, datalist=None)
- datalist is an instance of class DataList
- __str__(self)
- Generate HTML for the entire table and caption.
- color_code(self, value)
- return a color string based on whether the given datum
falls beyond thresholds. Works off self.thresholds=(low,hi).
- normalize(self)
- Scale data to values between 0 and 400.
Determine peak value and set scale accordingly. If the values
are clustered within 30% of each other, will shift the zero
point for the barchart up to exagerate the value differences.
To inhibit this, set the .bound_zero attribute to "yes".
- pixels(self, magnitude)
- returns the integer number of pixels to represent a given magnitude.
Data and other attributes inherited from BarChart:
- bar_shade = '#DDDDDD'
- label_shade = '#FFFFFF'
- max_width = 400
- title = ''
- value_shade = '#9999CC'
- zero = 0
| |