|
@@ -27,7 +27,9 @@ from ..widgets import (
|
|
|
AutoCompleteFloatEdit,
|
|
|
FocusWidget,
|
|
|
AutoCompletePopUp,
|
|
|
- NoTabCheckBox
|
|
|
+ NoTabCheckBox,
|
|
|
+ FlowBarGraph,
|
|
|
+ FlowGraphVScale,
|
|
|
)
|
|
|
from . import ActivityManager
|
|
|
from .Rating import Rating
|
|
@@ -140,7 +142,24 @@ class TransactionEditor(FocusWidget):
|
|
|
_avg, _min, _max = [
|
|
|
float(x) for x in df[['avg','min','max']].iloc[0]
|
|
|
]
|
|
|
- self.rating.update_rating(_avg, _min, _max, unit, price=price, quantity=quantity),
|
|
|
+ self.rating.update_rating(_avg, _min, _max, unit, price=price, quantity=quantity)
|
|
|
+ #print(df)
|
|
|
+ #input()
|
|
|
+ self.graph._invalidate()
|
|
|
+ top = 10 # need to set this same as in column widget
|
|
|
+ scale = (df['max'].apply(float).iloc[0]/top)*(top+1)
|
|
|
+ self.graph.set_bar_width(1)
|
|
|
+ # need to sort by ts and take last 45 items
|
|
|
+ self.graph.set_data(df[['ts_raw','$/unit']].apply(
|
|
|
+ lambda x, axis=None: (
|
|
|
+ x['ts_raw'].timestamp(), float(x['$/unit'])
|
|
|
+ ), axis=1), scale)
|
|
|
+ self.graph_vscale._invalidate()
|
|
|
+ self.graph_vscale.set_scale([
|
|
|
+ ((_min*top)//scale, f'{_min:>5.2f} '),
|
|
|
+ ((_avg*top)//scale, f'{_avg:>5.2f} '),
|
|
|
+ ((_max*top)//scale, f'{_max:>5.2f} '),
|
|
|
+ ], top)
|
|
|
|
|
|
|
|
|
def focus_on_product(self):
|
|
@@ -183,6 +202,8 @@ class TransactionEditor(FocusWidget):
|
|
|
'spread': Text(''),
|
|
|
'marker': Text(''),
|
|
|
}
|
|
|
+ self.graph = FlowBarGraph(['bg','badge_highlight','popup_focus', ], hatt=['dark red', 'dark red', 'dark red'])
|
|
|
+ self.graph_vscale = FlowGraphVScale(self.graph, [], 0)
|
|
|
self.rating = Rating(dict(filter(
|
|
|
lambda x: x[0] in ('spread','rating','marker'),
|
|
|
self.text_fields.items()
|
|
@@ -252,10 +273,16 @@ class TransactionEditor(FocusWidget):
|
|
|
lambda x: _widgets[x] if x is not None else Divider(),
|
|
|
bottom_pane
|
|
|
)),
|
|
|
- (50, Pile([LineBox(
|
|
|
- AttrMap(components['badge'], 'badge'),
|
|
|
- title="Current Price", title_align='left',
|
|
|
- )])),
|
|
|
+ (50, Pile([
|
|
|
+ LineBox(
|
|
|
+ AttrMap(components['badge'], 'badge'),
|
|
|
+ title="Current Price", title_align='left',
|
|
|
+ ),
|
|
|
+ Columns([
|
|
|
+ (6, self.graph_vscale),
|
|
|
+ (44, self.graph),
|
|
|
+ ])
|
|
|
+ ])),
|
|
|
])
|
|
|
})
|
|
|
connect_signal(self.buttons['done'], 'click', lambda _: save_and_clear_cb())
|