awsc.termui.bar_graph.BarGraph

class awsc.termui.bar_graph.BarGraph(*args, color=Color(Palette8Bit, 220, None), highlight_color=Color(Palette8Bit, 70, None), **kwargs)

In the most particular culmination of horrible ideas, this control attempts to - remarkably successfully, if I might add - display a bar graph in a terminal environment. It is fully capable of displaying a timestamped time series in an understandable fashion.

Attributes:
DPB_ZeroOrLessToMaxint

Data point behaviour constant. Bar graphs with this data point behaviour will extend their min-point to the negative numbers if any datapoint is negative, but will never place their min-point higher than zero.

DPB_ZeroToMaxint

Data point behaviour constant. Bar graphs with this data point behaviour will always place their min-point at zero, even if some datapoints are negative. Negative datapoints will be displayed as an empty bar.

DPB_MinToMaxint

Data point behaviour constant. Bar graphs with this data point behaviour will always place their min-point at the value of the lowest datapoint, regardless of whether it is negative, zero or positive.

subdivisionsdict

The characters used to represent subdivisions of a single character cell. The key zero represents an empty cell, positive numbers up to 8 represent that many eighths of a cell to be filled on a bar extending upwards, while negative numbers are the same down to -8 for a bar extending downwards. The question mark represents cells where something went horribly wrong.

datapointslist(tuple(datetime.datetime, float))

A list of datapoints in the time series. Each datapoint is a tuple of the time of measuring, and the value of the datapoint.

max_pointfloat

The calculated highest datapoint in the graph.

min_pointfloat

The calculated lowest datapoint in the graph.

colorawsc.termui.color.Color

The main color to use for text and unselected columns.

highlight_colorawsc.termui.color.Color

The color to use for highlighted columns.

leftint

The offset for how many columns to skip before drawing - basically, the amount you are scrolled to the right by.

highlightint

The index of the selected column.

Methods

Autohotkey(key[, tooltip, is_validated, ...])

Decorator that automatically assigns a hotkey to a function upon instantiation.

add_block(block)

Adds a new child block to this block.

add_datapoint(timestamp, datapoint)

Inserts a new datapoint into the bar graph.

add_hotkey(hotkey, action[, tooltip, ...])

Adds a new hotkey to the control.

autohotkey_condition(hotkey)

Autohotkey condition callback.

before_paint()

Hook function for acting on the block before any blocks are painted for the current frame.

bottomright()

Returns the coordinates of the bottom right corner of the block.

clear_blocks([tag])

Removes all blocks with the matching tag from the child blocks of this block.

end(*args)

Hotkey callback for KEY_END.

home(*args)

Hotkey callback for KEY_HOME.

input(key)

Input handler hook function.

paint()

Hook function for painting the block.

remove_block(block)

Removes a specific block from this block.

reparent()

Shorthand function for removing a Block from its parent and re-adding it.

scroll_left(*args)

Hotkey callback for KEY_LEFT.

scroll_right(*args)

Hotkey callback for KEY_RIGHT.

topleft()

Returns the coordinates of the top left corner of the block.

validate_hotkey(key)

Validates whether a hotkey can be used based on the state of the control.

on_become_frame

__init__(*args, color=Color(Palette8Bit, 220, None), highlight_color=Color(Palette8Bit, 70, None), **kwargs)

Initializes a HotkeyControl object.

Methods

__init__(*args[, color, highlight_color])

Initializes a HotkeyControl object.

add_block(block)

Adds a new child block to this block.

add_datapoint(timestamp, datapoint)

Inserts a new datapoint into the bar graph.

add_hotkey(hotkey, action[, tooltip, ...])

Adds a new hotkey to the control.

autohotkey_condition(hotkey)

Autohotkey condition callback.

before_paint()

Hook function for acting on the block before any blocks are painted for the current frame.

bottomright()

Returns the coordinates of the bottom right corner of the block.

clear_blocks([tag])

Removes all blocks with the matching tag from the child blocks of this block.

end(*args)

Hotkey callback for KEY_END.

home(*args)

Hotkey callback for KEY_HOME.

input(key)

Input handler hook function.

on_become_frame()

paint()

Hook function for painting the block.

remove_block(block)

Removes a specific block from this block.

reparent()

Shorthand function for removing a Block from its parent and re-adding it.

scroll_left(*args)

Hotkey callback for KEY_LEFT.

scroll_right(*args)

Hotkey callback for KEY_RIGHT.

topleft()

Returns the coordinates of the top left corner of the block.

validate_hotkey(key)

Validates whether a hotkey can be used based on the state of the control.

Attributes

DPB_MinToMax

DPB_ZeroOrLessToMax

DPB_ZeroToMax

border

Returns the border of the control.

colspace

Read-only property representing the amount of displayable columns.

corners

Read-only property for calculating the four corners of the block.

data_points_behaviour

Property representing the data points behaviour of this bar graph.

height

Read-only property for the height of the block.

inner

Read-only property for calculating the four inner corners of the block.

w_in

Read-only property for the inner width of the block.

width

Read-only property for the width of the block.