stanley-king 2 years ago
parent
commit
438b0d4536
1 changed files with 22 additions and 0 deletions
  1. 22 0
      plot/refill/ChannelCovSuccPainter.py

+ 22 - 0
plot/refill/ChannelCovSuccPainter.py

@@ -63,6 +63,28 @@ class ChannelCovSuccPainter(ChannelPainter):
 
         return buf, result
 
+    def _fig_funs(self):
+        def create():
+            fig = Figure(figsize=(19, 8))
+            ax = fig.subplots()
+            ax.set_title('success ratio')
+            ax.set(xlabel='time', ylabel='ratio')
+            return ax, fig
+
+        def flush(ax, fig, ticks, lables):
+            ax.set_xticks(ticks=ticks)
+            ax.set_xticklabels(lables)
+            fig.autofmt_xdate()
+            ax.grid()
+            fig.subplots_adjust(left=0.1, right=0.8, top=0.95, bottom=0.1)
+            ax.legend(bbox_to_anchor=(1, 1), loc='upper left')
+
+            buf = BytesIO()
+            fig.savefig(buf, format="png")
+            return buf
+
+        return create, flush
+
     def _label(self, chname, succ, count, card_type=None, spec=None):
         _card_type = None
         if card_type == 1: