Inherits from
- AbstractOverlay: enthought.chaco.abstract_overlay.AbstractOverlay
Attributes
- align
The position of the legend with respect to its overlaid component. (This attribute applies only if the legend is used as an overlay.)
- ur = Upper Right
- ul = Upper Left
- ll = Lower Left
- lr = Lower Right
align = Enum('ur', 'ul', 'll', 'lr')
- bgcolor
The background color of the legend (overrides AbstractOverlay).
bgcolor = white_color_trait
- border_padding
The amount of space between the content of the legend and the border.
border_padding = Int(10)
- border_visible
The border is visible (overrides Enable Component).
border_visible = True
- clip_to_component
Should the legend clip to the bounds it needs, or to its parent?
clip_to_component = Bool(False)
- composite_icon_renderer
The renderer that draws the icons for the legend.
composite_icon_renderer = Instance(AbstractCompositeIconRenderer)
- draw_layer
The legend is drawn on the overlay layer of its parent (overrides PlotComponent).
draw_layer = 'overlay'
- error_icon
Action that the legend takes when it encounters a plot whose icon it cannot render:
- 'skip': skip it altogether and don't render its name
- 'blank': render the name but leave the icon blank (color=self.bgcolor)
- 'questionmark': render a "question mark" icon
error_icon = Enum('skip', 'blank', 'questionmark')
- font
The font to use for the legend text.
font = KivaFont('modern 12')
- hide_invisible_plots
Whether or not to hide plots that are not visible. (This is checked during layout.) This option will filter out the items in labels above, so if you absolutely, positively want to set the items that will always display in the legend, regardless of anything else, then you should turn this option off. Otherwise, it usually makes sense that a plot renderer that is not visible will also not be in the legend.
hide_invisible_plots = Bool(True)
- icon_bounds
The size of the icon or marker area drawn next to the label.
icon_bounds = List([ 24, 24 ])
- icon_spacing
Amount of spacing between each label and its icon.
icon_spacing = Int(5)
- invisible_plot_alpha
If hide_invisible_plots is False, we can still choose to render the names of invisible plots with an alpha.
invisible_plot_alpha = Float(0.33000000000000002)
- labels
The list of labels to show and the order to show them in. If this list is blank, then the keys of self.plots is used and displayed in alphabetical order. Otherwise, only the items in the labels list are drawn in the legend. Labels are ordered from top to bottom.
labels = List
- line_spacing
The amount of space between legend items.
line_spacing = Int(3)
- plots
Map of labels (strings) to plot instances or lists of plot instances. The Legend determines the appropriate rendering of each plot's marker/line.
plots = Dict
- resizable
The legend is not resizable (overrides PlotComponent).
resizable = 'hv'
- unified_draw
The legend draws itself as in one pass when its parent is drawing the draw_layer (overrides PlotComponent).
unified_draw = True
Inherited from base classes
- accepts_focus
- active_tool
- aspect_ratio
- auto_center
- auto_handle_event
- backbuffer_padding
- border_color
- border_dash
- border_width
- bounds
- classes
- container
- controller
- cursor_color
- cursor_style
- draw_order
- draw_valid
- drawn_outer_bounds
- drawn_outer_position
- event_state
- fill_padding
- get
- height
- hpadding
- id
- inset_border
- invisible_layout
- layout_needed
- on_trait_event
- outer_bounds
- outer_height
- outer_position
- outer_width
- outer_x
- outer_x2
- outer_y
- outer_y2
- overlay_border
- overlays
- padding
- padding_accepts_focus
- padding_bottom
- padding_left
- padding_right
- padding_top
- pointer
- position
- set
- tools
- tooltip
- trait_added
- trait_modified
- underlays
- use_backbuffer
- use_draw_order
- use_selection
- viewports
- visible
- vpadding
- width
- window
- wrappers
- x
- x2
- y
- y2
Method summary
- get_label_at(self, x, y)
- get_preferred_size(self)
- is_in(self, x, y)
- overlay(self, component, gc, view_bounds = None, mode = 'normal')
Inherited from base classes
- __deepcopy__(self, memo)
- __getstate__(self)
- __prefix_trait__(self, name, is_set)
- __reduce_ex__(self, protocol)
- __setstate__(self, state, trait_change_notify = True)
- add_class_trait(cls, name, *trait)
- add_trait(self, name, *trait)
- add_trait_category(cls, category)
- add_trait_listener(self, object, prefix = '')
- all_trait_names(self)
- as_coordinates(self)
- base_trait(self, name)
- class_default_traits_view(cls)
- class_editable_traits(cls)
- class_trait_names(cls, **metadata)
- class_trait_view(cls, name = None, view_element = None)
- class_trait_view_elements(cls)
- class_traits(cls, **metadata)
- cleanup(self, window)
- clone_traits(self, traits = None, memo = None, copy = None, **metadata)
- configure_traits(self, filename = None, view = None, kind = None, edit = True, context = None, handler = None, id = '', scrollable = None, **args)
- copy_traits(self, other, traits = None, memo = None, copy = None, **metadata)
- copyable_trait_names(self, **metadata)
- default_traits_view(self)
- dispatch(self, event, suffix)
- do_layout(self, size = None, force = False)
- draw(self, gc, view_bounds = None, mode = 'default')
- draw_select_box(self, gc, position, bounds, width, dash, inset, color, bgcolor, marker_size)
- edit_traits(self, view = None, parent = None, kind = None, context = None, handler = None, id = '', scrollable = None, **args)
- editable_traits(self)
- get_absolute_coords(self, *coords)
- get_event_transform(self, event = None, suffix = '')
- has_traits_interface(self, *interfaces)
- invalidate_and_redraw(self)
- invalidate_draw(self, damaged_regions = None, self_relative = False)
- on_trait_change(self, handler, name = None, remove = False, dispatch = 'same', priority = False, deferred = False)
- print_traits(self, show_help = False, **metadata)
- remove_trait(self, name)
- remove_trait_listener(self, object, prefix = '')
- request_redraw(self)
- reset_traits(self, traits = None, **metadata)
- set_outer_bounds(self, ndx, val)
- set_outer_position(self, ndx, val)
- set_trait_dispatch_handler(cls, name, klass, override = False)
- sync_trait(self, trait_name, object, alias = None, mutual = True, remove = False)
- trait(self, name, force = False, copy = False)
- trait_context(self)
- trait_get(self, *names, **metadata)
- trait_monitor(cls, handler, remove = False)
- trait_names(self, **metadata)
- trait_set(self, trait_change_notify = True, **traits)
- trait_setq(self, **traits)
- trait_subclasses(cls, all = False)
- trait_view(self, name = None, view_element = None)
- trait_view_elements(self)
- trait_views(self, klass = None)
- traits(self, **metadata)
- validate_trait(self, name, value)
Methods
- get_label_at(self, x, y)
Returns the label object at (x,y)
- get_preferred_size(self)
Computes the size and position of the legend based on the maximum size of the labels, the alignment, and position of the component to overlay.
- is_in(self, x, y)
overloads from parent class because legend alignment and padding does not cooperatate with the basic implementation
This may just be caused byt a questionable implementation of the legend tool, but it works by adjusting the padding. The Component class implementation of is_in uses the outer positions which includes the padding
- overlay(self, component, gc, view_bounds = None, mode = 'normal')
Draws this component overlaid on another component.
Implements AbstractOverlay.