|
@@ -129,15 +129,25 @@ class ChannelPainter(object):
|
|
else:
|
|
else:
|
|
window = None
|
|
window = None
|
|
|
|
|
|
|
|
+ chname_ratios = []
|
|
for _chname, _card_type, _spec, _data in gen:
|
|
for _chname, _card_type, _spec, _data in gen:
|
|
succ, count, y = calc_chratios(_data, pos_map, self._start_time - day_stamp, self._end_time - day_stamp)
|
|
succ, count, y = calc_chratios(_data, pos_map, self._start_time - day_stamp, self._end_time - day_stamp)
|
|
y = np.convolve(y, window, 'same') if window is not None else y
|
|
y = np.convolve(y, window, 'same') if window is not None else y
|
|
- ax.plot(x, y, ls='-', label=self._label(chname=_chname, succ=succ, count=count, card_type=_card_type, spec=_spec))
|
|
|
|
|
|
+ label, ratio = self._label(chname=_chname, succ=succ, count=count, card_type=_card_type, spec=_spec)
|
|
|
|
+ ax.plot(x, y, ls='-', label=label)
|
|
|
|
+ if _card_type is None and _spec is None and _chname != 'all':
|
|
|
|
+ chname_ratios.append((_chname, ratio))
|
|
|
|
|
|
ticks = [d - self._start_time for d in range(self._start_time, self._end_time + 1, self._interval)]
|
|
ticks = [d - self._start_time for d in range(self._start_time, self._end_time + 1, self._interval)]
|
|
xlables = [time.strftime('%d-%H:%M:%S', time.localtime(d + self._start_time)) for d in ticks]
|
|
xlables = [time.strftime('%d-%H:%M:%S', time.localtime(d + self._start_time)) for d in ticks]
|
|
|
|
+ buf = fig_flush(ax, fig, ticks, xlables)
|
|
|
|
|
|
- return fig_flush(ax, fig, ticks, xlables)
|
|
|
|
|
|
+ chname_ratios = sorted(chname_ratios, key=lambda x: (x[1], x[0]), reverse=True)
|
|
|
|
+ result = []
|
|
|
|
+ for name, ratio in chname_ratios:
|
|
|
|
+ result.append(f'{name}:{ratio}')
|
|
|
|
+
|
|
|
|
+ return buf, result
|
|
|
|
|
|
def _label(self, chname, succ, count, card_type=None, spec=None):
|
|
def _label(self, chname, succ, count, card_type=None, spec=None):
|
|
_card_type = None
|
|
_card_type = None
|
|
@@ -167,4 +177,4 @@ class ChannelPainter(object):
|
|
ratio = 0.00
|
|
ratio = 0.00
|
|
lable += f":{succ}/{count}={ratio}%"
|
|
lable += f":{succ}/{count}={ratio}%"
|
|
|
|
|
|
- return lable
|
|
|
|
|
|
+ return lable, ratio
|