Package ascii_graph

class ascii_graph.__init__.Pyasciigraph(line_length=79, min_graph_length=50, separator_length=2, force_max_value=None, graphsymbol=None, multivalue=True, human_readable=None, float_format=u'{0:.0f}')

Constructor of Pyasciigraph

Parameters:
  • line_length (int) – the max number of char on a line if any line cannot be shorter, it will go over this limit. Default: 79
  • min_graph_length (int) – the min number of char used by the graph itself. Default: 50
  • force_max_value – if provided, force a max value in order to graph each line with respect to it (only taking the actual max value if it is greater).
  • separator_length (int) – the length of field separator. Default: 2
  • graphsymbol (str or unicode (length one)) – the symbol used for the graph bar. Default: ‘█’
  • multivalue (boolean) – displays all the values if multivalued when True. displays only the max value if False Default: True
  • human_readable (string (si, cs, none)) –

    trigger human readable display (K, G, etc) Default: None (raw value display)

    • ‘si’ for power of 1000
    • ‘cs’ for power of 1024
    • any other value for raw value display)
  • float_format – formatting of the float value Default: ‘{0:.0f}’ (convert to integers). expample: ‘{:,.2f}’ (2 decimals, ‘.’ to separate decimal and int, ‘,’ every three power of tens).
Type:

force_max_value: int

graph(label=None, data=[])

function generating the graph

Parameters:
  • label (string) – the label of the graph
  • data (iterable) – the data (list of tuple (info, value)) info must be “castable” to a unicode string value must be an int or a float
Return type:

a list of strings (each lines of the graph)