Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
bliss
Commits
e077d9d6
Commit
e077d9d6
authored
Jun 08, 2021
by
Valentin Valls
Browse files
Added appendData
parent
b7d428d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
bliss/flint/client/plots.py
View file @
e077d9d6
...
...
@@ -666,6 +666,15 @@ class TimeCurvePlot(BasePlot):
"""
self
.
submit
(
"setData"
,
**
kwargs
)
def
append_data
(
self
,
**
kwargs
):
"""
Append the data displayed in this plot.
Arguments:
kwargs: Name of the data associated to the numpy array to append
"""
self
.
submit
(
"appendData"
,
**
kwargs
)
class
ImageView
(
BasePlot
):
...
...
bliss/flint/custom_plots/time_curve_plot.py
View file @
e077d9d6
...
...
@@ -12,6 +12,7 @@ import numpy
from
silx.gui
import
qt
from
silx.gui.plot
import
Plot1D
from
silx.gui.plot.items
import
axis
as
axis_mdl
_logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -34,6 +35,8 @@ class TimeCurvePlot(qt.QWidget):
layout
=
qt
.
QVBoxLayout
(
self
)
layout
.
addWidget
(
self
.
__plot
)
self
.
__maxPoints
=
100
self
.
__plot
.
setGraphXLabel
(
"Time"
)
xAxis
=
self
.
__plot
.
getXAxis
()
xAxis
.
setTickMode
(
axis_mdl
.
TickMode
.
TIME_SERIES
)
...
...
@@ -73,6 +76,8 @@ class TimeCurvePlot(qt.QWidget):
data
=
numpy
.
concatenate
((
data
,
newData
))
else
:
data
=
newData
if
len
(
data
)
>
self
.
__maxPoints
:
data
=
data
[
-
self
.
__maxPoints
:]
self
.
__data
[
name
]
=
data
def
selectCurve
(
self
,
yName
,
**
kwargs
):
...
...
@@ -89,6 +94,12 @@ class TimeCurvePlot(qt.QWidget):
self
.
__data
=
dict
(
kwargs
)
self
.
__safeUpdatePlot
()
def
appendData
(
self
,
**
kwargs
):
"""Update the current data with extra data"""
for
name
,
data
in
kwargs
.
items
():
self
.
__appendData
(
name
,
data
)
self
.
__safeUpdatePlot
()
def
__safeUpdatePlot
(
self
):
try
:
self
.
__updatePlot
()
...
...
@@ -96,12 +107,10 @@ class TimeCurvePlot(qt.QWidget):
_logger
.
critical
(
"Error while updating the plot"
,
exc_info
=
True
)
def
__updatePlot
(
self
):
self
.
__plot
.
clear
()
xData
=
self
.
__data
.
get
(
self
.
__xAxisName
)
if
xData
is
None
:
return
for
name
,
style
in
self
.
__description
.
items
():
yData
=
self
.
__data
.
get
(
name
)
if
yData
is
None
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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