diff --git a/asciichartpy/__init__.py b/asciichartpy/__init__.py index de642d4..0ee9593 100644 --- a/asciichartpy/__init__.py +++ b/asciichartpy/__init__.py @@ -22,6 +22,13 @@ def plot(series, cfg={}): minimum = cfg['minimum'] if 'minimum' in cfg else min(series) maximum = cfg['maximum'] if 'maximum' in cfg else max(series) + +# for series with one elements or fill with the same value +# not the perfect solution but it works + if minimum == maximum : + maximum += 0.00001 + + interval = abs(float(maximum) - float(minimum)) offset = cfg['offset'] if 'offset' in cfg else 3 padding = cfg['padding'] if 'padding' in cfg else ' '