kroitor / asciichart

Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies
MIT License
1.87k stars 94 forks source link

Python crashes on empty charts #32

Closed ubershmekel closed 4 years ago

ubershmekel commented 5 years ago

Trying to chart with an empty list shouldn't crash.

import asciichartpy

asciichartpy.plot([])

Causes this:

Traceback (most recent call last):
  File "terminal_chart.py", line 18, in <module>
    print(asciichartpy.plot(losses, chart_config))
  File "/Users/lib/python3.7/site-packages/asciichartpy/__init__.py", line 25, in plot
    ratio = height / interval
ZeroDivisionError: float division by zero
pkazmier commented 4 years ago

38 fixes this btw.

kroitor commented 4 years ago

Thank you so much! Merged and fixed in asciichartpy 1.5.10!

https://pypi.org/project/asciichartpy/