Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SkywardHub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
SkywardHub
Commits
24c20995
Commit
24c20995
authored
2 years ago
by
Alberto Nidasio
Browse files
Options
Downloads
Patches
Plain Diff
[Graph] Fixed legend and timestamp reset
parent
7430b3ce
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Modules/Graph/Graph.cpp
+22
-4
22 additions, 4 deletions
Modules/Graph/Graph.cpp
Modules/Graph/Graph.h
+1
-1
1 addition, 1 deletion
Modules/Graph/Graph.h
with
23 additions
and
5 deletions
Modules/Graph/Graph.cpp
+
22
−
4
View file @
24c20995
...
@@ -93,8 +93,7 @@ void Graph::onClearClicked()
...
@@ -93,8 +93,7 @@ void Graph::onClearClicked()
{
{
for
(
auto
graph
:
graphs
)
for
(
auto
graph
:
graphs
)
graph
->
data
()
->
clear
();
graph
->
data
()
->
clear
();
plot
->
replot
();
// plot->replot();
}
}
void
Graph
::
onStopClicked
(
bool
checked
)
void
Graph
::
onStopClicked
(
bool
checked
)
...
@@ -125,14 +124,21 @@ void Graph::onSubscriptionAdded(const TopicAndFieldFilter& filter)
...
@@ -125,14 +124,21 @@ void Graph::onSubscriptionAdded(const TopicAndFieldFilter& filter)
graphs
.
append
(
graph
);
graphs
.
append
(
graph
);
buffersX
.
append
(
QVector
<
double
>
());
buffersX
.
append
(
QVector
<
double
>
());
buffersY
.
append
(
QVector
<
double
>
());
buffersY
.
append
(
QVector
<
double
>
());
qDebug
()
<<
"Graph index:"
<<
graphs
.
indexOf
(
graph
);
}
}
}
}
void
Graph
::
onSubscriptionRemoved
(
const
TopicAndFieldFilter
&
filter
)
void
Graph
::
onSubscriptionRemoved
(
const
TopicAndFieldFilter
&
filter
)
{
{
qDebug
()
<<
"Removing filter"
<<
filter
.
toString
();
if
(
filters
.
contains
(
filter
))
if
(
filters
.
contains
(
filter
))
{
{
int
index
=
filters
.
indexOf
(
filter
);
int
index
=
filters
.
indexOf
(
filter
);
qDebug
()
<<
"Filter found, index:"
<<
index
;
plot
->
removeGraph
(
graphs
[
index
]);
plot
->
replot
();
filters
.
removeAt
(
index
);
filters
.
removeAt
(
index
);
graphs
.
removeAt
(
index
);
graphs
.
removeAt
(
index
);
...
@@ -202,9 +208,21 @@ void Graph::onMsgReceived(const ModuleMessage& msg)
...
@@ -202,9 +208,21 @@ void Graph::onMsgReceived(const ModuleMessage& msg)
double
x
=
msg
.
getField
(
"timestamp"
).
getUInteger
(
0
)
/
1e6
;
double
x
=
msg
.
getField
(
"timestamp"
).
getUInteger
(
0
)
/
1e6
;
double
y
=
value
.
getDouble
(
0
);
double
y
=
value
.
getDouble
(
0
);
// Check if the timestamp resets
if
(
bufferX
.
last
()
<
x
)
{
bufferX
.
append
(
x
);
bufferX
.
append
(
x
);
bufferY
.
append
(
y
);
bufferY
.
append
(
y
);
}
}
else
{
bufferX
.
clear
();
bufferY
.
clear
();
auto
graph
=
graphs
[
index
];
graph
->
data
()
->
clear
();
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Modules/Graph/Graph.h
+
1
−
1
View file @
24c20995
...
@@ -47,7 +47,7 @@ private:
...
@@ -47,7 +47,7 @@ private:
QList
<
QVector
<
double
>>
buffersY
;
QList
<
QVector
<
double
>>
buffersY
;
QTimer
updaterTimer
;
QTimer
updaterTimer
;
int
updatePeriod
=
1000
/
10
;
int
updatePeriod
=
1000
/
5
;
// 5fps
bool
stopped
=
false
;
bool
stopped
=
false
;
bool
following
=
true
;
bool
following
=
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment