/ . / CGLtk / Histogram.py / HistogramMarkers
Color-designating markers on a histogram
Instances should only created via the addmarkers() method of
MarkedHistogram. Options can be specified as keyword arguments
to that function.
Contained HistogramMarker instances can be accessed as if
HistogramMarker were a sequence. The instances are always kept
sorted ascending in X, so sequence order can change with any
method that adds markers (e.g. a marker added with append
may not wind up at the end of the sequence). Methods that create
new HistogramMarker instances (append, extend, insert, __setitem__)
need 2-tuples/lists for each HistogramMarker instance, the
first component of which is the XY value (i.e. another 2-tuple
or list) and the second of which is the color info. The color
info can be either:
an RGBA value
None (use the newmarker color)
a color name
an instance that has either an rgba attribute or
an argless rgba method (e.g. a MaterialColor)
The MarkedHistogram and HistogramMarker doc strings should be
examined for further info on usage.
Options are:
- boxradius
- the radius in pixels of boxes drawn when the
markertype is
box
default: 2
- connect
- [init option] whether markers should be
connected left-to-right with lines. Typically
used only when the markertype is
box .
default: False
- connectcolor
- [init option] the color used to draw
lines connecting markers (
connect must be True)
default: yellow
- coordtype
- either
relative or absolute . If the former,
then the xy option of contained HistgramMarkers are
in the range 0-1 and indicate positioning relative to
left/right and bottom/top of the histogram. If the
latter, then the x of xy indicates a histogram
bin by value and a height by count.
default: absolute
- histogram
- [init option provided automatically by
MarkedHistogram.addmarkers()] the MarkedHistogram
instance
- markertype
- [init option] the type of markers to use,
either
line (vertical bars) or box (squares).
default: line
- maxmarks/minmarks
- the maximum/minimum amount of marks the
user is allowed to place on the histogram. A value of
None indicates no limit. Can always be exceeded
programmatically.
default: None
- movecallback
- [init option] function to call when the user
moves a marker. The function receives a value of
start at the beginning of a move and end at the
end. During the move the value is the marker being
moved.
default: None
- newcolor
- the default color assigned to newly-created
markers.
default: yellow
Methods
|
|
|
__init__
|
__init__ (
self,
parent=None,
**kw,
)
|
|
index
|
index ( self, marker )
|
|
extend
|
extend ( self, vals )
|
|
append
|
append ( self, val )
|
|
sort
|
sort ( self, sortFunc=None )
|
|
__getitem__
|
__getitem__ ( self, i )
|
|
insert
|
insert (
self,
i,
val,
)
|
|
__iter__
|
__iter__ ( self )
|
|
__delitem__
|
__delitem__ ( self, i )
|
|
__setitem__
|
__setitem__ (
self,
i,
val,
)
|
|
remove
|
remove ( self, marker )
|
|
|