Browse Source

add LineBox around graph and fix data dimensions and color palette

Daniel Sheffield 2 years ago
parent
commit
a4a2a91893
2 changed files with 8 additions and 9 deletions
  1. 7 8
      app/activities/TransactionEditor.py
  2. 1 1
      grocery_transactions.py

+ 7 - 8
app/activities/TransactionEditor.py

@@ -146,11 +146,7 @@ class TransactionEditor(FocusWidget):
         self.rating.update_rating(_avg, _min, _max, unit, price=price, quantity=quantity)
         df = df.sort_values('ts_raw', ascending=True).truncate(after=self.graph._canvas_width-1)
         self.graph.set_data(
-            df[['ts_raw','$/unit']].apply(
-                lambda x, axis=None: (
-                    x['ts_raw'].timestamp(), float(x['$/unit'])
-                ), axis=1
-            ),
+            df[['$/unit']].apply(lambda x: (float(x['$/unit']),), axis=1),
             df['max'].apply(float).iloc[0],
             labels=[_min, _avg, _max]
         )
@@ -200,7 +196,7 @@ class TransactionEditor(FocusWidget):
         }
         self.graph = FlowBarGraphWithVScale(
             50, 14,
-            ['bg','badge_highlight','popup_focus', ],
+            ['bg','popup_focus', ],
             hatt=['dark red', 'dark red', 'dark red']
         )
         self.rating = Rating(dict(filter(
@@ -272,12 +268,15 @@ class TransactionEditor(FocusWidget):
               lambda x: _widgets[x] if x is not None else Divider(),
               bottom_pane
             )),
-            (self.graph.total_width, Pile([
+            (self.graph.total_width+2, Pile([
               LineBox(
                 AttrMap(components['badge'], 'badge'),
                 title="Current Price", title_align='left',
               ),
-              self.graph,
+              LineBox(
+                self.graph,
+                title="Historic Price", title_align='left'
+              ),
             ])),
           ])
         })

+ 1 - 1
grocery_transactions.py

@@ -40,7 +40,7 @@ except:
 dark_palette = [
     ('popup_focus', 'black', 'light red'),
     ('popup', 'black', 'dark red'),
-    ('banner', 'light gray', 'dark red'),
+    ('banner', 'white', 'dark red'),
     ('streak', 'light red', 'black'),
     ('bg', 'light red', 'black'),
     ('badge', 'light gray', 'black'),