Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
HEV - High Energy Ventilator
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
HEV - High Energy Ventilator
Commits
a2df9cf4
Commit
a2df9cf4
authored
Apr 28, 2021
by
Benjamin Mummery
💻
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ui_dev' into ui_brain_and_brawn
parents
74ec0065
77cfb00e
Pipeline
#1444
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
27 deletions
+110
-27
plot_widget.py
NativeUI/widget_library/plot_widget.py
+110
-27
No files found.
NativeUI/widget_library/plot_widget.py
View file @
a2df9cf4
...
...
@@ -33,25 +33,45 @@ class TimePlotsWidget(QtWidgets.QWidget):
layout
=
QtWidgets
.
QVBoxLayout
()
self
.
graph_widget
=
pg
.
GraphicsLayoutWidget
()
layout
.
addWidget
(
self
.
graph_widget
)
self
.
pressure_plot
=
self
.
graph_widget
.
addPlot
(
labels
=
{
"left"
:
NativeUI
.
text
[
"plot_axis_label_pressure"
]}
labelStyle
=
{
"color"
:
"#FFF"
,
"font-size"
:
"15pt"
}
self
.
pressure_plot
=
self
.
graph_widget
.
addPlot
()
self
.
pressure_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_pressure"
],
**
labelStyle
)
self
.
pressure_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
pressure_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
pressure_plot
.
getAxis
(
"bottom"
)
.
setStyle
(
showValues
=
False
)
self
.
graph_widget
.
nextRow
()
self
.
flow_plot
=
self
.
graph_widget
.
addPlot
(
labels
=
{
"left"
:
NativeUI
.
text
[
"plot_axis_label_flow"
]}
self
.
flow_plot
=
self
.
graph_widget
.
addPlot
()
self
.
flow_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_flow"
],
**
labelStyle
#labels={"left": NativeUI.text["plot_axis_label_flow"]}
)
self
.
flow_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
flow_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
flow_plot
.
getAxis
(
"bottom"
)
.
setStyle
(
showValues
=
False
)
self
.
flow_plot
.
setXLink
(
self
.
pressure_plot
)
self
.
graph_widget
.
nextRow
()
self
.
volume_plot
=
self
.
graph_widget
.
addPlot
(
labels
=
{
"left"
:
NativeUI
.
text
[
"plot_axis_label_volume"
],
"bottom"
:
NativeUI
.
text
[
"plot_axis_label_time"
],
}
self
.
volume_plot
=
self
.
graph_widget
.
addPlot
()
self
.
volume_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_volume"
],
**
labelStyle
)
self
.
volume_plot
.
setLabel
(
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_time"
],
**
labelStyle
# labels={
# "left": NativeUI.text["plot_axis_label_volume"],
# "bottom": NativeUI.text["plot_axis_label_time"],
# }
)
self
.
volume_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
volume_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
volume_plot
.
setXLink
(
self
.
pressure_plot
)
self
.
graph_widget
.
nextRow
()
...
...
@@ -61,12 +81,17 @@ class TimePlotsWidget(QtWidgets.QWidget):
self
.
graph_widget
.
setBackground
(
self
.
NativeUI
.
colors
[
"page_background"
])
# Add grid, hide the autoscale button, and add the legend
font
=
QtGui
.
QFont
()
# TODO: change to an imported font from NativeuI
font
.
setPixelSize
(
24
)
for
plot
in
self
.
plots
:
plot
.
showGrid
(
x
=
True
,
y
=
True
)
plot
.
hideButtons
()
l
=
plot
.
addLegend
(
offset
=
(
-
1
,
1
))
l
.
setLabelTextSize
(
self
.
NativeUI
.
text_size
)
plot
.
setMouseEnabled
(
x
=
False
,
y
=
False
)
plot
.
getAxis
(
"bottom"
)
.
setStyle
(
tickFont
=
font
)
plot
.
getAxis
(
"left"
)
.
setStyle
(
tickFont
=
font
)
# Set Range
self
.
update_plot_time_range
(
61
)
...
...
@@ -133,28 +158,59 @@ class CirclePlotsWidget(QtWidgets.QWidget):
self
.
graph_widget
=
pg
.
GraphicsLayoutWidget
()
layout
.
addWidget
(
self
.
graph_widget
)
self
.
pressure_flow_plot
=
self
.
graph_widget
.
addPlot
(
labels
=
{
"bottom"
:
NativeUI
.
text
[
"plot_axis_label_flow"
],
"left"
:
NativeUI
.
text
[
"plot_axis_label_pressure"
],
}
labelStyle
=
{
"color"
:
"#FFF"
,
"font-size"
:
"15pt"
}
self
.
pressure_flow_plot
=
self
.
graph_widget
.
addPlot
()
self
.
pressure_flow_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_pressure"
],
**
labelStyle
)
self
.
pressure_flow_plot
.
setLabel
(
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_flow"
],
**
labelStyle
# labels={
# "bottom": NativeUI.text["plot_axis_label_flow"],
# "left": NativeUI.text["plot_axis_label_pressure"],
# }
)
self
.
pressure_flow_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
pressure_flow_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
graph_widget
.
nextRow
()
self
.
flow_volume_plot
=
self
.
graph_widget
.
addPlot
(
labels
=
{
"bottom"
:
NativeUI
.
text
[
"plot_axis_label_volume"
],
"left"
:
NativeUI
.
text
[
"plot_axis_label_flow"
],
}
self
.
flow_volume_plot
=
self
.
graph_widget
.
addPlot
()
self
.
flow_volume_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_volume"
],
**
labelStyle
)
self
.
flow_volume_plot
.
setLabel
(
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_flow"
],
**
labelStyle
# labels={
# "bottom": NativeUI.text["plot_axis_label_volume"],
# "left": NativeUI.text["plot_axis_label_flow"],
# }
)
self
.
flow_volume_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
flow_volume_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
graph_widget
.
nextRow
()
self
.
volume_pressure_plot
=
self
.
graph_widget
.
addPlot
(
labels
=
{
"bottom"
:
NativeUI
.
text
[
"plot_axis_label_pressure"
],
"left"
:
NativeUI
.
text
[
"plot_axis_label_volume"
],
}
self
.
volume_pressure_plot
=
self
.
graph_widget
.
addPlot
()
self
.
volume_pressure_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_pressure"
],
**
labelStyle
)
self
.
volume_pressure_plot
.
setLabel
(
"bottom"
,
NativeUI
.
text
[
"plot_axis_label_flow"
],
**
labelStyle
# labels={
# "bottom": NativeUI.text["plot_axis_label_pressure"],
# "left": NativeUI.text["plot_axis_label_volume"],
# }
)
self
.
volume_pressure_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
volume_pressure_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
graph_widget
.
nextRow
()
self
.
graph_widget
.
nextRow
()
...
...
@@ -170,12 +226,18 @@ class CirclePlotsWidget(QtWidgets.QWidget):
self
.
graph_widget
.
setBackground
(
self
.
NativeUI
.
colors
[
"page_background"
])
# Add grid, hide the autoscale button, and add the legend
font
=
QtGui
.
QFont
()
# TODO: change to an imported font from NativeuI
font
.
setPixelSize
(
25
)
for
plot
in
self
.
plots
:
plot
.
showGrid
(
x
=
True
,
y
=
True
)
plot
.
hideButtons
()
l
=
plot
.
addLegend
(
offset
=
(
-
1
,
1
))
l
.
setLabelTextSize
(
self
.
NativeUI
.
text_size
)
plot
.
setMouseEnabled
(
x
=
False
,
y
=
False
)
plot
.
getAxis
(
"bottom"
)
.
setStyle
(
tickFont
=
font
)
plot
.
getAxis
(
"left"
)
.
setStyle
(
tickFont
=
font
)
# Plot styles
self
.
pressure_flow_line
=
self
.
plot
(
...
...
@@ -232,15 +294,29 @@ class ChartsPlotWidget(QtWidgets.QWidget):
self
.
port
=
port
layout
=
QtWidgets
.
QHBoxLayout
()
# Set up the graph widget
self
.
graph_widget
=
pg
.
GraphicsLayoutWidget
()
layout
.
addWidget
(
self
.
graph_widget
)
labelStyle
=
{
"color"
:
"#FFF"
,
"font-size"
:
"15pt"
}
# Add the plot axes to the graph widget
self
.
display_plot
=
self
.
graph_widget
.
addPlot
(
labels
=
{
"left"
:
"????"
,
"bottom"
:
"????"
}
self
.
display_plot
=
self
.
graph_widget
.
addPlot
()
self
.
display_plot
.
setLabel
(
"left"
,
"????"
,
**
labelStyle
)
self
.
display_plot
.
setLabel
(
"bottom"
,
"????"
,
**
labelStyle
# labels={"left": "????", "bottom": "????"}
)
self
.
display_plot
.
getAxis
(
"left"
)
.
setTextPen
(
"w"
)
self
.
display_plot
.
getAxis
(
"bottom"
)
.
setTextPen
(
"w"
)
self
.
graph_widget
.
nextRow
()
# Store plots in a list in case we need to add additional axes in the future.
...
...
@@ -266,11 +342,18 @@ class ChartsPlotWidget(QtWidgets.QWidget):
self
.
graph_widget
.
setContentsMargins
(
0.0
,
0.0
,
0.0
,
0.0
)
self
.
graph_widget
.
setBackground
(
colors
[
"page_background"
])
self
.
legends
=
[]
font
=
QtGui
.
QFont
()
# TODO: change to an imported font from NativeuI
font
.
setPixelSize
(
25
)
for
plot
in
plots
:
plot
.
showGrid
(
x
=
True
,
y
=
True
)
plot
.
hideButtons
()
plot
.
setMouseEnabled
(
x
=
False
,
y
=
False
)
self
.
legends
.
append
(
plot
.
addLegend
(
offset
=
(
-
1
,
1
)))
plot
.
getAxis
(
"bottom"
)
.
setStyle
(
tickFont
=
font
)
plot
.
getAxis
(
"left"
)
.
setStyle
(
tickFont
=
font
)
self
.
setLayout
(
layout
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment