How to use the termgraph.chart function in termgraph

To help you get started, we’ve selected a few termgraph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dufferzafar / netuse / netuse.py View on Github external
:returns: None
    """

    # Get this month's file list
    down_filelist, _ = gen_file_list()

    # Iterate over every file in this week
    week = {}
    for file in down_filelist[-7:]:
        week[file.split('/')[-1]] = calculate(read_files([file])) // MB

    data = sorted(week.items())

    print("Data downloaded this week:\n")
    termgraph.chart(
        labels=["%s%s" % (d[0], ordinal_suffix(int(d[0]))) for d in data],
        data=[d[1] for d in data],
        args=dict(
            width=30,
            suffix=" MB",
            format="{:>5.0f}",
        )
    )

    print("Total: %d MB" % sum([d[1] for d in data]))