[billreminder] Pass data to charting widget in the proper format.



commit 9b534559293e34fcc66c5a4158416a8dbe625cd0
Author: Og B. Maciel <ogmaciel gnome org>
Date:   Thu Nov 26 12:50:01 2009 -0500

    Pass data to charting widget in the proper format.

 src/gui/maindialog.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/maindialog.py b/src/gui/maindialog.py
index 2fcea7d..ce7c395 100644
--- a/src/gui/maindialog.py
+++ b/src/gui/maindialog.py
@@ -306,16 +306,20 @@ class MainDialog:
     def _populate_chart(self, status, start, end):
 
         records = []
+        categories = []
+        totals = []
 
         try:
             records = self.actions.get_monthly_totals(start, end)
             # Chart widget takes data in format (('CategoryName', amount),)
-            records = [(c if c else 'None',float(t)) for c,t in records]
+            categories = [cat for cat,total in records]
+            totals = [float(total) for cat,total in records]
+            #records = [(c if c else 'None',float(t)) for c,t in records]
         except Exception, e:
             print "%s - %s" % (records, str(e))
             pass
 
-        self.chart.plot(records)
+        self.chart.plot(categories, totals)
 
     def _populate_menubar(self):
         # Create a UIManager instance



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]