Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SADAPMAP
Interface
Commits
22ebb9d8
Commit
22ebb9d8
authored
Nov 11, 2019
by
Pedro Henrique Kopper
Browse files
Adicionar gráfico combinado
parent
731be5dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
threads/Graph.py
View file @
22ebb9d8
...
...
@@ -42,6 +42,7 @@ class Graph():
#self.plots[i].getViewBox().setRange(xRange=(self.dataX[0][-1] - 10, self.dataX[0][-1]))
self
.
plots
[
i
].
setData
(
self
.
dataX
[
i
],
self
.
dataY
[
i
])
self
.
logFile
.
write
(
"{},"
.
format
(
self
.
dataY
[
i
][
-
1
]))
self
.
combinedPlot
.
setData
(
self
.
dataY
[
1
],
self
.
dataY
[
0
])
self
.
logFile
.
write
(
"{}"
.
format
(
self
.
dataX
[
0
][
-
1
]))
self
.
logFile
.
flush
()
...
...
@@ -64,9 +65,9 @@ class Graph():
def
_configurePlots
(
self
):
self
.
logger
(
"[GRAPH]"
,
"Found new device {}"
.
format
(
self
.
config
[
"device"
][
"type"
]))
self
.
debugLayout
=
self
.
graph
.
addLayout
(
colspan
=
len
(
self
.
device
[
"channels"
]))
for
channel
in
self
.
device
[
"channels"
]:
plotItem
=
self
.
graph
.
addPlot
()
plotItem
=
self
.
debugLayout
.
addPlot
()
plot
=
plotItem
.
plot
(
pen
=
mkPen
(
mkColor
(
channel
[
"color"
]),
width
=
2
),
name
=
channel
[
"id"
])
self
.
plots
.
append
(
plot
)
plotItem
.
setClipToView
(
True
)
...
...
@@ -85,3 +86,13 @@ class Graph():
# Faz com que ambos eixos X se movam juntos sempre
# TODO: escrever de forma mais limpa
self
.
plots
[
0
].
getViewBox
().
linkView
(
self
.
plots
[
0
].
getViewBox
().
XAxis
,
self
.
plots
[
1
].
getViewBox
())
self
.
graph
.
nextRow
()
self
.
combinedPlot
=
self
.
graph
.
addPlot
()
self
.
combinedPlot
.
setClipToView
(
True
)
self
.
combinedPlot
.
showGrid
(
True
)
self
.
combinedPlot
.
getViewBox
().
enableAutoRange
(
plotItem
.
getViewBox
().
YAxis
)
self
.
combinedPlot
.
setLabel
(
"left"
,
text
=
"Amostra"
,
units
=
"V"
)
self
.
combinedPlot
.
setLabel
(
"bottom"
,
text
=
"Pressão"
,
units
=
"bar"
)
self
.
combinedPlot
=
self
.
combinedPlot
.
plot
(
pen
=
mkPen
(
mkColor
(
"#FF0000"
),
width
=
2
))
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