chaco.overlays.simple_inspector_overlay module¶
A simple inspector overlay for plots
This module provides the SimpleInspectorOverlay for displaying information gathered from an inspector tool in a TextGrid. By default it is configured to work with a SimpleInspectorTool.
The module also provides some helper factory functions for creating text formatters for dictionary values.
-
class
chaco.overlays.simple_inspector_overlay.
SimpleInspectorOverlay
(*components, **traits)¶ Bases:
chaco.overlays.text_grid_overlay.TextGridOverlay
Simple inspector overlay for plots
This is a simple overlay that listens for new_value events on a SimpleInspectorTool and displays formatted values in a grid.
By default this displays the ‘x’ and ‘y’ values provided by the SimpleInspectorTool, but instances can provide a field_formatters trait which is a list of lists of callables which extract values from a dictionary and formats them. Each callable corresponds to a cell in the underlying TextGrid component.
Although by default this works with the SimpleInspectorTool, with appropriate field_formatters this class can be used with any inspector tool that follows the same API.
-
chaco.overlays.simple_inspector_overlay.
basic_formatter
(key, decimals)¶ Create a basic ‘<key>: <value>’ formatting function
This factory creates a function that formats a specified key and with a numerical value from a dictionary into a string.
- Parameters
key – The dictionary key to format.
decimals – The number of decimal places to show.
- Returns
A factory function that takes a dictionary and returns a string.
- Return type
format
-
chaco.overlays.simple_inspector_overlay.
date_formatter
(key)¶ Create a date formatting function
This factory creates a function that formats a specified key and with a timestamp value from a dictionary into a ‘yyyy/mm/dd’ format string.
- Parameters
key – The dictionary key to format. The corresponding value should be a timestamp.
- Returns
A factory function that takes a dictionary and returns a string.
- Return type
format
-
chaco.overlays.simple_inspector_overlay.
datetime_formatter
(key, time_format='%Y/%m/%d %H:%M:%S')¶ Create a datetime formatting function
This factory creates a function that formats a specified key and with a timestamp value from a dictionary into a string.
- Parameters
key – The dictionary key to format. The corresponding value should be a timestamp.
time_format – A format string suitable for strftime().
- Returns
A factory function that takes a dictionary and returns a string.
- Return type
format
-
chaco.overlays.simple_inspector_overlay.
time_formatter
(key)¶ Create a time formatting function
This factory creates a function that formats a specified key and with a timestamp value from a dictionary into a ‘HH:MM:SS’ format string.
- Parameters
key – The dictionary key to format. The corresponding value should be a timestamp.
- Returns
A factory function that takes a dictionary and returns a string.
- Return type
format