An error occurred while loading the file. Please try again.
-
Pierre-Antoine Rouby authoreda836b78c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# -*- coding: utf-8 -*-
from tools import timer
from View.Plot.APlot import APlot
from PyQt5.QtCore import (
QCoreApplication
)
_translate = QCoreApplication.translate
class PlotFlow(APlot):
def __init__(self, canvas=None, data=None, toolbar=None):
super(PlotFlow, self).__init__(
canvas=canvas,
data=data,
toolbar=toolbar
)
@timer
def draw(self, highlight=None):
self.canvas.axes.cla()
self.canvas.axes.grid(color='grey', linestyle='--', linewidth=0.5)
if self.data is None:
return
self.canvas.axes.set_ylabel(
_translate("MainWindow_reach", "Flow (m^3/s)"),
color='green', fontsize=11
)
self.canvas.axes.set_xlabel(
_translate("MainWindow_reach", "KP (m)"),
color='green', fontsize=11
)
kp = self.data.reach.reach.get_kp()
self.canvas.axes.set_xlim(
left = min(kp), right = max(kp)
)
if len(self.data) != 0:
kp = self.data.get_kp()
flow = self.data.get_flow()
self.line_kp_zmin = self.canvas.axes.plot(
kp, flow,
color='r', lw=1.
)
self.canvas.figure.tight_layout()
self.canvas.figure.canvas.draw_idle()
if self.toolbar is not None:
self.toolbar.update()
# self._init = True
@timer
def update(self, ind=None):
if self._init == False:
self.draw()
return