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
39531f6f
Commit
39531f6f
authored
Apr 27, 2021
by
Benjamin Mummery
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: Initial text size and colour options for plots
parent
3f800de6
Pipeline
#1437
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
25 deletions
+11
-25
plot_widget.py
NativeUI/widget_library/plot_widget.py
+11
-25
No files found.
NativeUI/widget_library/plot_widget.py
View file @
39531f6f
...
...
@@ -33,8 +33,12 @@ 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"
:
"14pt"
}
self
.
pressure_plot
=
self
.
graph_widget
.
addPlot
()
self
.
pressure_plot
.
setLabel
(
"left"
,
NativeUI
.
text
[
"plot_axis_label_pressure"
],
**
labelStyle
)
self
.
pressure_plot
.
getAxis
(
"bottom"
)
.
setStyle
(
showValues
=
False
)
self
.
graph_widget
.
nextRow
()
...
...
@@ -61,12 +65,16 @@ 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
(
20
)
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
)
...
...
@@ -105,12 +113,6 @@ class TimePlotsWidget(QtWidgets.QWidget):
"""
Get the current plots database and update the plots to match
"""
# plots = self.NativeUI.get_db("plots")
# Extend the non-time scales if we need to
self
.
pressure_plot
.
setYRange
(
*
plots
[
"pressure_axis_range"
])
self
.
flow_plot
.
setYRange
(
*
plots
[
"flow_axis_range"
])
self
.
volume_plot
.
setYRange
(
*
plots
[
"volume_axis_range"
])
# Replot lines with new data
self
.
pressure_line
.
setData
(
plots
[
"timestamp"
],
plots
[
"pressure"
])
...
...
@@ -208,11 +210,6 @@ class CirclePlotsWidget(QtWidgets.QWidget):
self
.
setLayout
(
layout
)
# self.timer = QtCore.QTimer()
# self.timer.setInterval(16) # just faster than 60Hz
# self.timer.timeout.connect(self.update_plot_data)
# self.timer.start()
def
plot
(
self
,
canvas
,
x
,
y
,
plotname
,
color
):
pen
=
pg
.
mkPen
(
color
=
color
,
width
=
3
)
return
canvas
.
plot
(
x
,
y
,
name
=
plotname
,
pen
=
pen
)
...
...
@@ -220,19 +217,8 @@ class CirclePlotsWidget(QtWidgets.QWidget):
@
QtCore
.
Slot
(
dict
)
def
update_plot_data
(
self
,
plots
:
dict
):
"""
Get the current plots database and update the plots to match
Update the plots to match the new data.
"""
# plots = self.NativeUI.get_db("plots")
# Extend the non-time scales if we need to
self
.
pressure_flow_plot
.
setXRange
(
*
plots
[
"flow_axis_range"
])
self
.
pressure_flow_plot
.
setYRange
(
*
plots
[
"pressure_axis_range"
])
self
.
flow_volume_plot
.
setXRange
(
*
plots
[
"volume_axis_range"
])
self
.
flow_volume_plot
.
setYRange
(
*
plots
[
"flow_axis_range"
])
self
.
volume_pressure_plot
.
setXRange
(
*
plots
[
"pressure_axis_range"
])
self
.
volume_pressure_plot
.
setYRange
(
*
plots
[
"volume_axis_range"
])
# Replot lines with new data
self
.
pressure_flow_line
.
setData
(
plots
[
"flow"
],
plots
[
"pressure"
])
self
.
flow_volume_line
.
setData
(
plots
[
"volume"
],
plots
[
"flow"
])
self
.
volume_pressure_line
.
setData
(
plots
[
"pressure"
],
plots
[
"volume"
])
...
...
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