* add support for high and low thresholds * update sparklines documentation * update the sparkline api docs
21 lines
739 B
Python
Executable file
21 lines
739 B
Python
Executable file
#!/usr/bin/env python3
|
|
"""Sparklines example.
|
|
|
|
This demonstrates using sparklines.
|
|
|
|
For more background on sparklines see Jon Udell's post: <https://blog.jonudell.net/2021/08/05/the-tao-of-unicode-sparklines/>
|
|
|
|
PYTHON_ARGCOMPLETE_OK
|
|
"""
|
|
from milc import cli, sparkline
|
|
|
|
|
|
@cli.entrypoint('Show a sparkline.')
|
|
def main(cli):
|
|
cli.log.info('sparkline1: %s', sparkline([5, 9, 3, 15, None, 22, 0, 45, -11, -22, -15], positive_color='{fg_green}'))
|
|
cli.log.info('sparkline2: %s', sparkline([0, 1, 19, 20]))
|
|
cli.log.info('sparkline3: %s', sparkline([0, 999, 4000, 4999, 7000, 7999], highlight_low=4001, highlight_high=7001, highlight_low_color='{fg_yellow}', highlight_high_color='{fg_magenta}'))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
cli()
|