From a30541c75affede09326e0895cf0069d0a15dc7d Mon Sep 17 00:00:00 2001 From: yehushuabendavid Date: Sun, 12 May 2019 09:06:40 +0300 Subject: [PATCH] Update __init__.py --- asciichartpy/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) 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 ' '