URI: 
       tfix #3962 - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 55a0a6b7f032c99846c713f058d8dd4f550fed63
   DIR parent 1825c92bbc873f23167eb72a4dc29127f346c7a5
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Sat, 24 Feb 2018 00:14:34 +0100
       
       fix #3962
       
       Diffstat:
         M gui/qt/history_list.py              |       8 ++++----
         M lib/plot.py                         |      20 +++++++++++++++++---
       
       2 files changed, 21 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/gui/qt/history_list.py b/gui/qt/history_list.py
       t@@ -33,7 +33,7 @@ from electrum.util import block_explorer_URL
        from electrum.util import timestamp_to_datetime, profiler
        
        try:
       -    from electrum.plot import plot_history
       +    from electrum.plot import plot_history, NothingToPlotException
        except:
            plot_history = None
        
       t@@ -195,11 +195,11 @@ class HistoryList(MyTreeWidget, AcceptFileDragDrop):
                        _("Can't plot history.") + '\n' +
                        _("Perhaps some dependencies are missing...") + " (matplotlib?)")
                    return
       -        if len(self.transactions) > 0:
       +        try:
                    plt = plot_history(self.transactions)
                    plt.show()
       -        else:
       -            self.parent.show_message(_("Nothing to plot."))
       +        except NothingToPlotException as e:
       +            self.parent.show_message(str(e))
        
            @profiler
            def on_update(self):
   DIR diff --git a/lib/plot.py b/lib/plot.py
       t@@ -14,7 +14,14 @@ from matplotlib.patches import Ellipse
        from matplotlib.offsetbox import AnchoredOffsetbox, TextArea, DrawingArea, HPacker
        
        
       +class NothingToPlotException(Exception):
       +    def __str__(self):
       +        return _("Nothing to plot.")
       +
       +
        def plot_history(history):
       +    if len(history) == 0:
       +        raise NothingToPlotException()
            hist_in = defaultdict(int)
            hist_out = defaultdict(int)
            for item in history:
       t@@ -42,12 +49,19 @@ def plot_history(history):
            xfmt = md.DateFormatter('%Y-%m')
            ax.xaxis.set_major_formatter(xfmt)
            width = 20
       -    dates, values = zip(*sorted(hist_in.items()))
       -    r1 = axarr[0].bar(dates, values, width, label='incoming')
       -    axarr[0].legend(loc='upper left')
       +
       +    r1 = None
       +    r2 = None
       +    dates_values = list(zip(*sorted(hist_in.items())))
       +    if dates_values and len(dates_values) == 2:
       +        dates, values = dates_values
       +        r1 = axarr[0].bar(dates, values, width, label='incoming')
       +        axarr[0].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')
       +    if r1 is None and r2 is None:
       +        raise NothingToPlotException()
            return plt