How to use the termgraph.termgraph.stacked_graph 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 mkaz / termgraph / tests / test_termgraph.py View on Github external
[508.97, 10.45], [212.05, 20.2], [30.0, 20.0]]
            normal_data = [[48.059508408796894, 50.0], [60.971862871927556, 0.0],
                           [3.080530401034929, 12.963561880120743],
                           [12.184670116429496, 0.5390254420008624],
                           [135.82632600258734, 1.4688443294523499],
                           [55.802608883139285, 4.096593359206555],
                           [6.737818025010781, 4.042690815006468]]
            len_categories = 2
            args = {'filename': 'data/ex4.dat', 'title': None, 'width': 50,
                    'format': '{:<5.2f}', 'suffix': '', 'no_labels': True,
                    'color': None, 'vertical': False, 'stacked': True,
                    'different_scale': False, 'calendar': False,
                    'start_dt': None, 'custom_tick': '', 'delim': '',
                    'verbose': False, 'version': False}
            colors = [91, 94]
            tg.stacked_graph(labels, data, normal_data, len_categories, args,
                             colors)
            output = output.getvalue().strip()
            assert output == '\x1b[91m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇\x1b[0m\x1b[94m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇\x1b[0m 373.84\n\x1b[91m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇\x1b[0m\x1b[94m▏\x1b[0m 236.23\n\x1b[91m▇▇▇\x1b[0m\x1b[94m▇▇▇▇▇▇▇▇▇▇▇▇\x1b[0m 69.53\n\x1b[91m▇▇▇▇▇▇▇▇▇▇▇▇\x1b[0m\x1b[94m▏\x1b[0m 57.21\n\x1b[91m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇\x1b[0m\x1b[94m▇\x1b[0m 519.42\n\x1b[91m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇\x1b[0m\x1b[94m▇▇▇▇\x1b[0m 232.25\n\x1b[91m▇▇▇▇▇▇\x1b[0m\x1b[94m▇▇▇▇\x1b[0m 50.00'
github mkaz / termgraph / tests / test_termgraph.py View on Github external
[508.97, 10.45], [212.05, 20.2], [30.0, 20.0]]
            normal_data = [[48.059508408796894, 50.0], [60.971862871927556, 0.0],
                           [3.080530401034929, 12.963561880120743],
                           [12.184670116429496, 0.5390254420008624],
                           [135.82632600258734, 1.4688443294523499],
                           [55.802608883139285, 4.096593359206555],
                           [6.737818025010781, 4.042690815006468]]
            len_categories = 2
            args = {'filename': 'data/ex4.dat', 'title': None, 'width': 50,
                    'format': '{:<5.2f}', 'suffix': '', 'no_labels': False,
                    'color': None, 'vertical': False, 'stacked': True,
                    'different_scale': False, 'calendar': False,
                    'start_dt': None, 'custom_tick': '', 'delim': '',
                    'verbose': False, 'version': False}
            colors = [91, 94]
            tg.stacked_graph(labels, data, normal_data, len_categories, args,
                             colors)
            output = output.getvalue().strip()
            assert output == '2007: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 373.84\n2008: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▏ 236.23\n2009: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 69.53\n2010: ▇▇▇▇▇▇▇▇▇▇▇▇▏ 57.21\n2011: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 519.42\n2012: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 232.25\n2014: ▇▇▇▇▇▇▇▇▇▇ 50.00'