chaco.tools.simple_inspector module¶
Simple Inspector tool for plots
This module provides a simple tool that reports the data-space coordinates of the current mouse cursor position in a plot. It is intended for use with SimpleInspectorOverlay, but other objects can potentially hook into its API.
-
class
chaco.tools.simple_inspector.
SimpleInspectorTool
(component=None, **traits)¶ Bases:
enable.base_tool.BaseTool
Simple inspector tool for plots
This is a simple tool that reports the data-space coordinates of the current mouse cursor position in a plot.
Interested overlays and other objects can listen for new_value events, which is a dictionary of data about the current location in data space, and can look at the last_mouse_position trait which holds the mouse position in screen space.
The tool also provides a visible trait which listeners can use to hide themselves. By default the ‘p’ key toggles this.
Instances can provide a value_generator function that performs computations to generate additional values in the dictionary that is passed to the new_value event. Subclasses can override gather_values() to similar effect.
-
gather_values
(event)¶ Generate the values for the new_value dictionary.
By default this returns a dictionary with keys “x”, “y”, “index” and “value”. If there is a value_generator callable, this will be called to modify the dictionary.
- Parameters
event – The mouse_move event.
- Returns
- Return type
A dictionary.
-
inspector_key
= <enable.base_tool.KeySpec object>¶ This key will show and hide any overlays listening to this tool.
-
last_mouse_position
= Tuple¶ Stores the last mouse position. This can be used by overlays to position themselves around the mouse.
-
map_to_data
(x, y)¶ Returns the data space coordinates of the given x and y.
Takes into account orientation of the plot and the axis setting.
-
new_value
= Event¶ This event fires whenever the mouse moves over a new image point. Its value is a dict with default keys “x”, “y”, “index” and “value”.
-
normal_key_pressed
(event)¶
-
normal_mouse_enter
(event)¶
-
normal_mouse_leave
(event)¶
-
normal_mouse_move
(event)¶
-
value_generator
= Callable¶ A callable that computes other values for the new_value event this takes a dictionary as an argument, and returns a dictionary
-
visible
= Bool(True)¶ Indicates whether overlays listening to this tool should be visible.
-