chore: изменил структуру описания виджетов осциллографа
This commit is contained in:
parent
3eb030cb2d
commit
ed9cda81cb
@ -101,37 +101,49 @@ class BasePlotWidget:
|
|||||||
"Welding"
|
"Welding"
|
||||||
]
|
]
|
||||||
|
|
||||||
self._plot_channels = {
|
self._plt_channels = {
|
||||||
"Electrode Force, N & Welding Current, kA": [
|
"Electrode Force, N & Welding Current, kA": {
|
||||||
|
"Settings": {
|
||||||
|
"zoom": False,
|
||||||
|
"stages": True
|
||||||
|
},
|
||||||
|
"Signals": [
|
||||||
{
|
{
|
||||||
"name": "Electrode Force, N ME",
|
"name": "Electrode Force, N ME",
|
||||||
"pen": 'r',
|
"pen": 'r',
|
||||||
"zoom": False
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"Electrode Force, N FE",
|
|
||||||
"pen": 'w',
|
|
||||||
"zoom": False
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Welding Current ME",
|
|
||||||
"pen": "y",
|
|
||||||
"zoom": False
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Electrode Force, N": [
|
|
||||||
{
|
|
||||||
"name": "Electrode Force, N ME",
|
|
||||||
"pen": 'r',
|
|
||||||
"zoom": True
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Electrode Force, N FE",
|
"name": "Electrode Force, N FE",
|
||||||
"pen": 'w',
|
"pen": 'w',
|
||||||
"zoom": True
|
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
"Electrode Speed, mm/s": [
|
"name": "Welding Current ME",
|
||||||
|
"pen": "y",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Electrode Force, N": {
|
||||||
|
"Settings": {
|
||||||
|
"zoom": True,
|
||||||
|
"stages": False
|
||||||
|
},
|
||||||
|
"Signals": [
|
||||||
|
{
|
||||||
|
"name": "Electrode Force, N ME",
|
||||||
|
"pen": 'r',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Electrode Force, N FE",
|
||||||
|
"pen": 'w',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Electrode Speed, mm/s": {
|
||||||
|
"Settings": {
|
||||||
|
"zoom": False,
|
||||||
|
"stages": True
|
||||||
|
},
|
||||||
|
"Signals": [
|
||||||
{
|
{
|
||||||
"name": "Rotor Speed, mm/s ME",
|
"name": "Rotor Speed, mm/s ME",
|
||||||
"pen": 'r',
|
"pen": 'r',
|
||||||
@ -141,8 +153,9 @@ class BasePlotWidget:
|
|||||||
"name": "Rotor Speed, mm/s FE",
|
"name": "Rotor Speed, mm/s FE",
|
||||||
"pen": 'w',
|
"pen": 'w',
|
||||||
"zoom": False
|
"zoom": False
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@ -7,27 +7,31 @@ from base.base import BasePlotWidget
|
|||||||
|
|
||||||
class PlotWidget(BasePlotWidget):
|
class PlotWidget(BasePlotWidget):
|
||||||
|
|
||||||
|
def _draw_stages(self, dataframe: pd.DataFrame) -> None:
|
||||||
|
...
|
||||||
|
|
||||||
def _create_widget(self, dataframe: pd.DataFrame) -> QWidget:
|
def _create_widget(self, dataframe: pd.DataFrame) -> QWidget:
|
||||||
widget = QWidget()
|
widget = QWidget()
|
||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
time_axis = dataframe["time"]
|
time_axis = dataframe["time"]
|
||||||
print(max(time_axis))
|
dataframe_headers = dataframe.columns.tolist()
|
||||||
|
|
||||||
for channel, signals in self._plot_channels.items():
|
for channel, description in self._plt_channels.items():
|
||||||
plot_widget = pg.PlotWidget(title=channel)
|
plot_widget = pg.PlotWidget(title=channel)
|
||||||
plot_widget.showGrid(x=True, y=True)
|
plot_widget.showGrid(x=True, y=True)
|
||||||
legend = pg.LegendItem((80, 60), offset=(70, 20))
|
legend = pg.LegendItem((80, 60), offset=(70, 20))
|
||||||
legend.setParentItem(plot_widget.graphicsItem())
|
legend.setParentItem(plot_widget.graphicsItem())
|
||||||
|
settings = description["Settings"]
|
||||||
|
|
||||||
for signal in signals:
|
for signal in description["Signals"]:
|
||||||
if signal["name"] in dataframe.columns.tolist():
|
if signal["name"] in dataframe_headers:
|
||||||
plot = plot_widget.plot(time_axis, dataframe[signal["name"]], pen=signal["pen"])
|
plot = plot_widget.plot(time_axis, dataframe[signal["name"]], pen=signal["pen"])
|
||||||
if signal["zoom"] and max(time_axis) < 5.0:
|
legend.addItem(plot, signal["name"])
|
||||||
|
if settings["zoom"] and max(time_axis) < 5.0:
|
||||||
max_value = max(dataframe[signal["name"]])
|
max_value = max(dataframe[signal["name"]])
|
||||||
plot_widget.setYRange(max_value - 200, max_value)
|
plot_widget.setYRange(max_value - 200, max_value)
|
||||||
plot_widget.setInteractive(False)
|
plot_widget.setInteractive(False)
|
||||||
legend.addItem(plot, signal["name"])
|
|
||||||
|
|
||||||
layout.addWidget(plot_widget)
|
layout.addWidget(plot_widget)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user