|
@@ -71,12 +71,12 @@ def trend_internal(conn: Connection[TupleRow], path: str, query: FormsDict):
|
|
|
yield abort(404, f"No data for {fields}")
|
|
|
return
|
|
|
|
|
|
+ progress.update({ "stage": "Preparing data", "percent": "30"})
|
|
|
+ yield template("loading", done=True) + template("loading", progress=progress)
|
|
|
+
|
|
|
in_chart = data['$/unit'].apply(lambda x: (x or False) and True)
|
|
|
data = data[in_chart]
|
|
|
|
|
|
- progress.update({ "stage": "Preparing data", "percent": "30"})
|
|
|
- yield template("loading", progress=progress)
|
|
|
-
|
|
|
pivot = data.pivot_table(index=['ts_raw',], columns=['product',], values=['$/unit'], aggfunc='mean')
|
|
|
pivot.columns = pivot.columns.droplevel()
|
|
|
sns.set_theme(style='darkgrid', palette='pastel', context="talk")
|
|
@@ -118,12 +118,12 @@ def trend_internal(conn: Connection[TupleRow], path: str, query: FormsDict):
|
|
|
spine.set_color('#ffffff')
|
|
|
|
|
|
progress.update({ "stage": "Rendering chart", "percent": "50"})
|
|
|
- yield template("loading", progress=progress)
|
|
|
+ yield template("loading", done=True) + template("loading", progress=progress)
|
|
|
|
|
|
f = StringIO()
|
|
|
plt.savefig(f, format='svg')
|
|
|
- progress.update({ "stage": "Done", "percent": "100", "complete": True})
|
|
|
- yield template("loading", end=True, progress=progress)
|
|
|
+ progress.update({ "stage": "Done", "percent": "100" })
|
|
|
+ yield template("loading", done=True) + template("loading", end=True, progress=progress)
|
|
|
|
|
|
organic = BOOLEAN.get(query.organic, None)
|
|
|
action = path.split('/')[-1]
|