stanley-king hace 2 años
padre
commit
c0174ae709
Se han modificado 2 ficheros con 15 adiciones y 2 borrados
  1. 2 2
      plot/refill/MerchantAmountPainter.py
  2. 13 0
      plot/refill/MerchantPainter.py

+ 2 - 2
plot/refill/MerchantAmountPainter.py

@@ -1,6 +1,6 @@
 from .DataStream import EMchPosmap as pos_map, span_days, time_border, calc_interval
 from .MerchantReader import MerchantReader
-from .MerchantPainter import MerchantPainter, allpathes
+from .MerchantPainter import MerchantPainter, mch_paths
 from matplotlib.figure import Figure
 from matplotlib import ticker
 from io import BytesIO
@@ -53,7 +53,7 @@ class MerchantAmountPainter(MerchantPainter):
 
     def paint(self):
         tuple_pathes = self._reader.many_tuple_path(self._days, self._mchids, self._card_types, self._spec)
-        gen = allpathes(self._reader, tuple_pathes, self._days, self._spec)
+        gen = mch_paths(self._reader, tuple_pathes, self._days, self._spec)
         if len(self._days) == 0:
             return BytesIO()
 

+ 13 - 0
plot/refill/MerchantPainter.py

@@ -20,6 +20,19 @@ def add_mchid(mchid):
 def get_mchids():
     return list(_all_mchids)
 
+def mch_paths(reader: MerchantReader, tuple_pathes: dict, days: list):
+    count = len(days)
+    for mchid, tup in tuple_pathes.items():
+        mch_datas = reader.init_data(count)
+        for _card_type, _spec in tup:
+            for i, day in enumerate(days):
+                data = reader.read(day, mchid, _card_type, _spec)
+                if data is not None:
+                    column_pos = i * 86400
+                    view = mch_datas[:, column_pos:column_pos + 86400]
+                    view += data
+        yield mchid, None, None, mch_datas
+
 def allpathes(reader: MerchantReader, tuple_pathes: dict, days: list, spec=None):
     count = len(days)
     show_detail = True if len(list(tuple_pathes.keys())) == 1 else False