Browse Source

fix plot plugin

283
ThomasV 10 years ago
parent
commit
b6e7dbe5f7
  1. 12
      plugins/plot.py

12
plugins/plot.py

@ -5,7 +5,7 @@ from electrum.i18n import _
import datetime import datetime
from electrum.util import format_satoshis from electrum.util import format_satoshis
from electrum.bitcoin import COIN
try: try:
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
@ -55,14 +55,12 @@ class Plugin(BasePlugin):
counter_trans = 0 counter_trans = 0
balance = 0 balance = 0
for item in history: for item in history:
tx_hash, confirmations, value, timestamp = item tx_hash, confirmations, value, timestamp, balance = item
balance += value
if confirmations: if confirmations:
if timestamp is not None: if timestamp is not None:
try: try:
datenums.append(md.date2num(datetime.datetime.fromtimestamp(timestamp))) datenums.append(md.date2num(datetime.datetime.fromtimestamp(timestamp)))
balance_string = format_satoshis(balance, False) balance_Val.append(1000.*balance/COIN)
balance_Val.append(float((format_satoshis(balance,False)))*1000.0)
except [RuntimeError, TypeError, NameError] as reason: except [RuntimeError, TypeError, NameError] as reason:
unknown_trans += 1 unknown_trans += 1
pass pass
@ -71,9 +69,7 @@ class Plugin(BasePlugin):
else: else:
pending_trans += 1 pending_trans += 1
value_string = format_satoshis(value, True) value_val.append(1000.*value/COIN)
value_val.append(float(value_string)*1000.0)
if tx_hash: if tx_hash:
label, is_default_label = wallet.get_label(tx_hash) label, is_default_label = wallet.get_label(tx_hash)
label = label.encode('utf-8') label = label.encode('utf-8')

Loading…
Cancel
Save