From a3f28456502d2869311d3c2f3c89605357455ed5 Mon Sep 17 00:00:00 2001 From: Pavol Babincak Date: Sat, 9 Dec 2017 20:35:46 +0100 Subject: [PATCH] Handle empty outgoing transactions for plot Previously dialog with error: need more than 0 values to unpack was displayed and not a plot. After this change plot is displayed without any dialog without graph of outgoing transactions and without legend for outgoing transactions. Fixes: #3487 --- lib/plot.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/plot.py b/lib/plot.py index 68595595..06f8edd7 100644 --- a/lib/plot.py +++ b/lib/plot.py @@ -46,7 +46,9 @@ def plot_history(wallet, history): dates, values = zip(*sorted(hist_in.items())) r1 = axarr[0].bar(dates, values, width, label='incoming') axarr[0].legend(loc='upper left') - dates, values = zip(*sorted(hist_out.items())) - r2 = axarr[1].bar(dates, values, width, color='r', label='outgoing') - axarr[1].legend(loc='upper left') + dates_values = list(zip(*sorted(hist_out.items()))) + if dates_values and len(dates_values) == 2: + dates, values = dates_values + r2 = axarr[1].bar(dates, values, width, color='r', label='outgoing') + axarr[1].legend(loc='upper left') return plt