stanley-king преди 2 години
родител
ревизия
a44295ff39
променени са 2 файла, в които са добавени 9 реда и са изтрити 8 реда
  1. 2 6
      plot/app.py
  2. 7 2
      plot/refill/ChannelSpeedAnalyzePainter.py

+ 2 - 6
plot/app.py

@@ -69,7 +69,6 @@ def ch_ratio():
     except Exception as ex:
         return onError(ex)
 
-#  http://192.168.3.104:5000/plot/ch_speed_ratio?&start_time=1664668800&end_time=1664704800&chnames=feimingyu_high&card_types=4&spec=100
 @app.route('/plot/ch_speed_ratio')
 def ch_speed_ratio():
     try:
@@ -83,14 +82,11 @@ def ch_speed_ratio():
         painter = ChannelSpeedAnalyzePainter(start_time=start_time, end_time=end_time,
                                              chnames=chnames, card_types=card_types, spec=spec,
                                              period=period)
-        buf = painter.paint()
+        buf , ratios = painter.paint()
         data = base64.b64encode(buf.getbuffer()).decode("ascii")
-        # return f"<img src='data:image/png;base64,{data}'/>"
-        # # return buf
-        return jsonify({'img': data, 'state': 'success'})
+        return jsonify({'img': data, 'ratios': ratios, 'state': 'success'})
     except Exception as ex:
         return onError(ex)
-    
 
 @app.route('/plot/ch_covratio')
 def ch_covratio():

+ 7 - 2
plot/refill/ChannelSpeedAnalyzePainter.py

@@ -1,6 +1,6 @@
 from .DataStream import EChPosmap as pos_map
 from .ChannelReader import ChannelReader
-from .ChannelPainter import ChannelPainter, ratio_pathes
+from .ChannelPainter import ChannelPainter, ratio_pathes, get_channels
 from matplotlib.figure import Figure
 from matplotlib import ticker
 from io import BytesIO
@@ -113,4 +113,9 @@ class ChannelSpeedAnalyzePainter(ChannelPainter):
         self._succ_hist(succs,ax_hist_succs)
         self._succ_cdf(succs,commits,ax_succ_cdf,ax_ratio_cdf,ax_ratio_latest)
         buf = self._flush(fig, ax_scatter, ax_succ_cdf, ax_hist_succs, ax_ratio_cdf, ax_ratio_latest)
-        return buf
+
+        result = []
+        channels = get_channels()
+        for name in channels:
+            result.append(f'{name}:0.00')
+        return buf,result