Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
b8a2ef1b
Commit
b8a2ef1b
authored
Dec 21, 2016
by
Gus Grubba
Committed by
GitHub
Dec 21, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4330 from dogmaphobic/charting
Charting Tweaks
parents
940a87b5
3262f6fc
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
153 additions
and
179 deletions
+153
-179
Linechart.ui
src/ui/Linechart.ui
+15
-6
ChartPlot.cc
src/ui/linechart/ChartPlot.cc
+47
-63
ChartPlot.h
src/ui/linechart/ChartPlot.h
+9
-8
IncrementalPlot.cc
src/ui/linechart/IncrementalPlot.cc
+16
-16
LinechartPlot.cc
src/ui/linechart/LinechartPlot.cc
+16
-16
LinechartWidget.cc
src/ui/linechart/LinechartWidget.cc
+50
-69
LinechartWidget.h
src/ui/linechart/LinechartWidget.h
+0
-1
No files found.
src/ui/Linechart.ui
View file @
b8a2ef1b
...
@@ -29,7 +29,16 @@
...
@@ -29,7 +29,16 @@
<string
notr=
"true"
/>
<string
notr=
"true"
/>
</property>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<property
name=
"margin"
>
<property
name=
"leftMargin"
>
<number>
6
</number>
</property>
<property
name=
"topMargin"
>
<number>
6
</number>
</property>
<property
name=
"rightMargin"
>
<number>
6
</number>
</property>
<property
name=
"bottomMargin"
>
<number>
6
</number>
<number>
6
</number>
</property>
</property>
<item>
<item>
...
@@ -103,8 +112,8 @@
...
@@ -103,8 +112,8 @@
<rect>
<rect>
<x>
0
</x>
<x>
0
</x>
<y>
0
</y>
<y>
0
</y>
<width>
8
84
</width>
<width>
8
79
</width>
<height>
4
91
</height>
<height>
4
62
</height>
</rect>
</rect>
</property>
</property>
</widget>
</widget>
...
@@ -113,7 +122,7 @@
...
@@ -113,7 +122,7 @@
<item
row=
"3"
column=
"0"
>
<item
row=
"3"
column=
"0"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<property
name=
"spacing"
>
<property
name=
"spacing"
>
<number>
2
</number>
<number>
4
</number>
</property>
</property>
<item>
<item>
<widget
class=
"QLineEdit"
name=
"plotFilterLineEdit"
>
<widget
class=
"QLineEdit"
name=
"plotFilterLineEdit"
>
...
@@ -139,7 +148,7 @@
...
@@ -139,7 +148,7 @@
<item>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_3"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_3"
>
<property
name=
"spacing"
>
<property
name=
"spacing"
>
<number>
0
</number>
<number>
6
</number>
</property>
</property>
<item>
<item>
<widget
class=
"QCheckBox"
name=
"shortNameCheckBox"
>
<widget
class=
"QCheckBox"
name=
"shortNameCheckBox"
>
...
@@ -172,7 +181,7 @@
...
@@ -172,7 +181,7 @@
<item>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_4"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_4"
>
<property
name=
"spacing"
>
<property
name=
"spacing"
>
<number>
0
</number>
<number>
6
</number>
</property>
</property>
<property
name=
"sizeConstraint"
>
<property
name=
"sizeConstraint"
>
<enum>
QLayout::SetMinimumSize
</enum>
<enum>
QLayout::SetMinimumSize
</enum>
...
...
src/ui/linechart/ChartPlot.cc
View file @
b8a2ef1b
...
@@ -2,80 +2,72 @@
...
@@ -2,80 +2,72 @@
#include "QGCApplication.h"
#include "QGCApplication.h"
const
QColor
ChartPlot
::
baseColors
[
numColors
]
=
{
const
QColor
ChartPlot
::
baseColors
[
numColors
]
=
{
QColor
(
242
,
255
,
128
),
QColor
(
242
,
255
,
128
),
QColor
(
70
,
80
,
242
),
QColor
(
70
,
80
,
242
),
QColor
(
232
,
33
,
47
),
QColor
(
232
,
33
,
47
),
QColor
(
116
,
251
,
110
),
QColor
(
116
,
251
,
110
),
QColor
(
81
,
183
,
244
),
QColor
(
81
,
183
,
244
),
QColor
(
234
,
38
,
107
),
QColor
(
234
,
38
,
107
),
QColor
(
92
,
247
,
217
),
QColor
(
92
,
247
,
217
),
QColor
(
151
,
59
,
239
),
QColor
(
151
,
59
,
239
),
QColor
(
231
,
72
,
28
),
QColor
(
231
,
72
,
28
),
QColor
(
236
,
48
,
221
),
QColor
(
236
,
48
,
221
),
QColor
(
75
,
133
,
243
),
QColor
(
75
,
133
,
243
),
QColor
(
203
,
254
,
121
),
QColor
(
203
,
254
,
121
),
QColor
(
104
,
64
,
240
),
QColor
(
104
,
64
,
240
),
QColor
(
200
,
54
,
238
),
QColor
(
200
,
54
,
238
),
QColor
(
104
,
250
,
138
),
QColor
(
104
,
250
,
138
),
QColor
(
235
,
43
,
165
),
QColor
(
235
,
43
,
165
),
QColor
(
98
,
248
,
176
),
QColor
(
98
,
248
,
176
),
QColor
(
161
,
252
,
116
),
QColor
(
161
,
252
,
116
),
QColor
(
87
,
231
,
246
),
QColor
(
87
,
231
,
246
),
QColor
(
230
,
126
,
23
)
QColor
(
230
,
126
,
23
)
};
};
ChartPlot
::
ChartPlot
(
QWidget
*
parent
)
:
ChartPlot
::
ChartPlot
(
QWidget
*
parent
)
:
QwtPlot
(
parent
),
QwtPlot
(
parent
),
nextColorIndex
(
0
),
_
nextColorIndex
(
0
),
symbolWidth
(
2.0
f
),
_
symbolWidth
(
2.0
f
),
curveWidth
(
2.0
f
),
_
curveWidth
(
2.0
f
),
gridWidth
(
0.8
f
)
_
gridWidth
(
0.8
f
)
{
{
// Initialize the list of curves.
// Initialize the list of curves.
curves
=
QMap
<
QString
,
QwtPlotCurve
*>
();
_curves
=
QMap
<
QString
,
QwtPlotCurve
*>
();
// Set the grid. The colorscheme was already set in generateColorScheme().
// Set the grid. The colorscheme was already set in generateColorScheme().
grid
=
new
QwtPlotGrid
;
_grid
=
new
QwtPlotGrid
;
grid
->
enableXMin
(
true
);
_grid
->
enableXMin
(
true
);
grid
->
attach
(
this
);
_grid
->
attach
(
this
);
_colors
=
QList
<
QColor
>
();
colors
=
QList
<
QColor
>
();
///> Color map for plots, includes 20 colors
///> Color map for plots, includes 20 colors
///> Map will start from beginning when the first 20 colors are exceeded
///> Map will start from beginning when the first 20 colors are exceeded
for
(
int
i
=
0
;
i
<
numColors
;
++
i
)
for
(
int
i
=
0
;
i
<
numColors
;
++
i
)
{
{
_colors
.
append
(
baseColors
[
i
]);
colors
.
append
(
baseColors
[
i
]);
}
}
// Now that all objects have been initialized, color everything.
// Now that all objects have been initialized, color everything.
styleChanged
(
qgcApp
()
->
styleIsDark
());
styleChanged
(
qgcApp
()
->
styleIsDark
());
}
}
ChartPlot
::~
ChartPlot
()
ChartPlot
::~
ChartPlot
()
{
{
}
}
QColor
ChartPlot
::
getNextColor
()
QColor
ChartPlot
::
getNextColor
()
{
{
if
(
nextColorIndex
>=
colors
.
count
())
if
(
_nextColorIndex
>=
_colors
.
count
())
{
{
_nextColorIndex
=
0
;
nextColorIndex
=
0
;
}
}
return
colors
[
nextColorIndex
++
];
return
_colors
[
_
nextColorIndex
++
];
}
}
QColor
ChartPlot
::
getColorForCurve
(
const
QString
&
id
)
QColor
ChartPlot
::
getColorForCurve
(
const
QString
&
id
)
{
{
return
curves
.
value
(
id
)
->
pen
().
color
();
return
_
curves
.
value
(
id
)
->
pen
().
color
();
}
}
void
ChartPlot
::
shuffleColors
()
void
ChartPlot
::
shuffleColors
()
{
{
foreach
(
QwtPlotCurve
*
curve
,
curves
)
foreach
(
QwtPlotCurve
*
curve
,
_curves
)
{
{
if
(
curve
->
isVisible
())
{
if
(
curve
->
isVisible
())
{
QPen
pen
(
curve
->
pen
());
QPen
pen
(
curve
->
pen
());
pen
.
setColor
(
getNextColor
());
pen
.
setColor
(
getNextColor
());
curve
->
setPen
(
pen
);
curve
->
setPen
(
pen
);
...
@@ -86,32 +78,24 @@ void ChartPlot::shuffleColors()
...
@@ -86,32 +78,24 @@ void ChartPlot::shuffleColors()
void
ChartPlot
::
styleChanged
(
bool
styleIsDark
)
void
ChartPlot
::
styleChanged
(
bool
styleIsDark
)
{
{
// Generate a new color list for curves and recolor them.
// Generate a new color list for curves and recolor them.
for
(
int
i
=
0
;
i
<
numColors
;
++
i
)
for
(
int
i
=
0
;
i
<
numColors
;
++
i
)
{
{
_colors
[
i
]
=
styleIsDark
?
baseColors
[
i
].
lighter
(
150
)
:
baseColors
[
i
].
darker
(
150
);
colors
[
i
]
=
styleIsDark
?
baseColors
[
i
].
lighter
(
150
)
:
baseColors
[
i
].
darker
(
150
);
}
}
shuffleColors
();
shuffleColors
();
// Configure the rest of the UI colors based on the current theme.
// Configure the rest of the UI colors based on the current theme.
if
(
styleIsDark
)
if
(
styleIsDark
)
{
{
// Set canvas background
// Set canvas background
setCanvasBackground
(
QColor
(
0
,
0
,
0
));
setCanvasBackground
(
QColor
(
0
,
0
,
0
));
// Configure the plot grid.
// Configure the plot grid.
grid
->
setMinorPen
(
QPen
(
QColor
(
0xAA
,
0xAA
,
0xAA
),
gridWidth
,
Qt
::
DotLine
));
_grid
->
setMinorPen
(
QPen
(
QColor
(
64
,
64
,
64
),
_gridWidth
,
Qt
::
SolidLine
));
grid
->
setMajorPen
(
QPen
(
QColor
(
0xDD
,
0xDD
,
0xDD
),
gridWidth
,
Qt
::
DotLine
));
_grid
->
setMajorPen
(
QPen
(
QColor
(
96
,
96
,
96
),
_gridWidth
,
Qt
::
SolidLine
));
}
}
else
{
else
{
// Set canvas background
// Set canvas background
setCanvasBackground
(
QColor
(
0xFF
,
0xFF
,
0xFF
));
setCanvasBackground
(
QColor
(
0xFF
,
0xFF
,
0xFF
));
// Configure the plot grid.
// Configure the plot grid.
grid
->
setMinorPen
(
QPen
(
QColor
(
0x55
,
0x55
,
0x55
),
gridWidth
,
Qt
::
Dot
Line
));
_grid
->
setMinorPen
(
QPen
(
QColor
(
192
,
192
,
192
),
_gridWidth
,
Qt
::
Solid
Line
));
grid
->
setMajorPen
(
QPen
(
QColor
(
0x22
,
0x22
,
0x22
),
gridWidth
,
Qt
::
Dot
Line
));
_grid
->
setMajorPen
(
QPen
(
QColor
(
128
,
128
,
128
),
_gridWidth
,
Qt
::
Solid
Line
));
}
}
// And finally refresh the widget to make sure all color changes are redrawn.
// And finally refresh the widget to make sure all color changes are redrawn.
replot
();
replot
();
}
}
src/ui/linechart/ChartPlot.h
View file @
b8a2ef1b
...
@@ -31,14 +31,15 @@ public slots:
...
@@ -31,14 +31,15 @@ public slots:
protected:
protected:
const
static
int
numColors
=
20
;
const
static
int
numColors
=
20
;
const
static
QColor
baseColors
[
numColors
];
const
static
QColor
baseColors
[
numColors
];
QList
<
QColor
>
colors
;
///< Colormap for curves
int
nextColorIndex
;
///< Next index in color map
QList
<
QColor
>
_colors
;
///< Colormap for curves
QMap
<
QString
,
QwtPlotCurve
*
>
curves
;
///< Plot curves
int
_nextColorIndex
;
///< Next index in color map
QwtPlotGrid
*
grid
;
///< Plot grid
QMap
<
QString
,
QwtPlotCurve
*
>
_curves
;
///< Plot curves
QwtPlotGrid
*
_grid
;
///< Plot grid
float
symbolWidth
;
///< Width of curve symbols in pixels
float
curveWidth
;
///< Width of curve lines in pixels
float
_symbolWidth
;
///< Width of curve symbols in pixels
float
gridWidth
;
///< Width of gridlines in pixels
float
_curveWidth
;
///< Width of curve lines in pixels
float
_gridWidth
;
///< Width of gridlines in pixels
};
};
#endif // CHARTPLOT_H
#endif // CHARTPLOT_H
src/ui/linechart/IncrementalPlot.cc
View file @
b8a2ef1b
...
@@ -143,7 +143,7 @@ void IncrementalPlot::showLegend(bool show)
...
@@ -143,7 +143,7 @@ void IncrementalPlot::showLegend(bool show)
void
IncrementalPlot
::
setStyleText
(
const
QString
&
style
)
void
IncrementalPlot
::
setStyleText
(
const
QString
&
style
)
{
{
styleText
=
style
.
toLower
();
styleText
=
style
.
toLower
();
foreach
(
QwtPlotCurve
*
curve
,
curves
)
{
foreach
(
QwtPlotCurve
*
curve
,
_
curves
)
{
updateStyle
(
curve
);
updateStyle
(
curve
);
}
}
replot
();
replot
();
...
@@ -161,24 +161,24 @@ void IncrementalPlot::updateStyle(QwtPlotCurve *curve)
...
@@ -161,24 +161,24 @@ void IncrementalPlot::updateStyle(QwtPlotCurve *curve)
// Update the symbol style
// Update the symbol style
QwtSymbol
*
newSymbol
=
NULL
;
QwtSymbol
*
newSymbol
=
NULL
;
if
(
styleText
.
contains
(
"circles"
))
{
if
(
styleText
.
contains
(
"circles"
))
{
newSymbol
=
new
QwtSymbol
(
QwtSymbol
::
Ellipse
,
Qt
::
NoBrush
,
QPen
(
oldColor
,
symbolWidth
),
QSize
(
6
,
6
));
newSymbol
=
new
QwtSymbol
(
QwtSymbol
::
Ellipse
,
Qt
::
NoBrush
,
QPen
(
oldColor
,
_
symbolWidth
),
QSize
(
6
,
6
));
}
else
if
(
styleText
.
contains
(
"crosses"
))
{
}
else
if
(
styleText
.
contains
(
"crosses"
))
{
newSymbol
=
new
QwtSymbol
(
QwtSymbol
::
XCross
,
Qt
::
NoBrush
,
QPen
(
oldColor
,
symbolWidth
),
QSize
(
5
,
5
));
newSymbol
=
new
QwtSymbol
(
QwtSymbol
::
XCross
,
Qt
::
NoBrush
,
QPen
(
oldColor
,
_
symbolWidth
),
QSize
(
5
,
5
));
}
else
if
(
styleText
.
contains
(
"rect"
))
{
}
else
if
(
styleText
.
contains
(
"rect"
))
{
newSymbol
=
new
QwtSymbol
(
QwtSymbol
::
Rect
,
Qt
::
NoBrush
,
QPen
(
oldColor
,
symbolWidth
),
QSize
(
6
,
6
));
newSymbol
=
new
QwtSymbol
(
QwtSymbol
::
Rect
,
Qt
::
NoBrush
,
QPen
(
oldColor
,
_
symbolWidth
),
QSize
(
6
,
6
));
}
}
// Else-case already handled by NULL value, which indicates no symbol
// Else-case already handled by NULL value, which indicates no symbol
curve
->
setSymbol
(
newSymbol
);
curve
->
setSymbol
(
newSymbol
);
// Update the line style
// Update the line style
if
(
styleText
.
contains
(
"dotted"
))
{
if
(
styleText
.
contains
(
"dotted"
))
{
curve
->
setPen
(
QPen
(
oldColor
,
curveWidth
,
Qt
::
DotLine
));
curve
->
setPen
(
QPen
(
oldColor
,
_
curveWidth
,
Qt
::
DotLine
));
}
else
if
(
styleText
.
contains
(
"dashed"
))
{
}
else
if
(
styleText
.
contains
(
"dashed"
))
{
curve
->
setPen
(
QPen
(
oldColor
,
curveWidth
,
Qt
::
DashLine
));
curve
->
setPen
(
QPen
(
oldColor
,
_
curveWidth
,
Qt
::
DashLine
));
}
else
if
(
styleText
.
contains
(
"line"
)
||
styleText
.
contains
(
"solid"
))
{
}
else
if
(
styleText
.
contains
(
"line"
)
||
styleText
.
contains
(
"solid"
))
{
curve
->
setPen
(
QPen
(
oldColor
,
curveWidth
,
Qt
::
SolidLine
));
curve
->
setPen
(
QPen
(
oldColor
,
_
curveWidth
,
Qt
::
SolidLine
));
}
else
{
}
else
{
curve
->
setPen
(
QPen
(
oldColor
,
curveWidth
,
Qt
::
NoPen
));
curve
->
setPen
(
QPen
(
oldColor
,
_
curveWidth
,
Qt
::
NoPen
));
}
}
curve
->
setStyle
(
QwtPlotCurve
::
Lines
);
curve
->
setStyle
(
QwtPlotCurve
::
Lines
);
}
}
...
@@ -260,22 +260,22 @@ void IncrementalPlot::appendData(const QString &key, double *x, double *y, int s
...
@@ -260,22 +260,22 @@ void IncrementalPlot::appendData(const QString &key, double *x, double *y, int s
}
}
// If this is a new curve, create it.
// If this is a new curve, create it.
if
(
!
curves
.
contains
(
key
))
{
if
(
!
_
curves
.
contains
(
key
))
{
curve
=
new
QwtPlotCurve
(
key
);
curve
=
new
QwtPlotCurve
(
key
);
curves
.
insert
(
key
,
curve
);
_
curves
.
insert
(
key
,
curve
);
curve
->
setStyle
(
QwtPlotCurve
::
NoCurve
);
curve
->
setStyle
(
QwtPlotCurve
::
NoCurve
);
curve
->
setPaintAttribute
(
QwtPlotCurve
::
FilterPoints
);
curve
->
setPaintAttribute
(
QwtPlotCurve
::
FilterPoints
);
// Set the color. Only the pen needs to be set
// Set the color. Only the pen needs to be set
const
QColor
&
c
=
getNextColor
();
const
QColor
&
c
=
getNextColor
();
curve
->
setPen
(
c
,
symbolWidth
);
curve
->
setPen
(
c
,
_
symbolWidth
);
qDebug
()
<<
"Creating curve"
<<
key
<<
"with color"
<<
c
;
qDebug
()
<<
"Creating curve"
<<
key
<<
"with color"
<<
c
;
updateStyle
(
curve
);
updateStyle
(
curve
);
curve
->
attach
(
this
);
curve
->
attach
(
this
);
}
else
{
}
else
{
curve
=
curves
.
value
(
key
);
curve
=
_
curves
.
value
(
key
);
}
}
data
->
append
(
x
,
y
,
size
);
data
->
append
(
x
,
y
,
size
);
...
@@ -359,21 +359,21 @@ int IncrementalPlot::data(const QString &key, double* r_x, double* r_y, int maxS
...
@@ -359,21 +359,21 @@ int IncrementalPlot::data(const QString &key, double* r_x, double* r_y, int maxS
*/
*/
void
IncrementalPlot
::
showGrid
(
bool
show
)
void
IncrementalPlot
::
showGrid
(
bool
show
)
{
{
grid
->
setVisible
(
show
);
_
grid
->
setVisible
(
show
);
replot
();
replot
();
}
}
bool
IncrementalPlot
::
gridEnabled
()
const
bool
IncrementalPlot
::
gridEnabled
()
const
{
{
return
grid
->
isVisible
();
return
_
grid
->
isVisible
();
}
}
void
IncrementalPlot
::
removeData
()
void
IncrementalPlot
::
removeData
()
{
{
foreach
(
QwtPlotCurve
*
curve
,
curves
)
{
foreach
(
QwtPlotCurve
*
curve
,
_
curves
)
{
delete
curve
;
delete
curve
;
}
}
curves
.
clear
();
_
curves
.
clear
();
foreach
(
CurveData
*
data
,
d_data
)
{
foreach
(
CurveData
*
data
,
d_data
)
{
delete
data
;
delete
data
;
...
...
src/ui/linechart/LinechartPlot.cc
View file @
b8a2ef1b
...
@@ -190,7 +190,7 @@ void LinechartPlot::removeTimedOutCurves()
...
@@ -190,7 +190,7 @@ void LinechartPlot::removeTimedOutCurves()
{
{
// Remove this curve
// Remove this curve
// Delete curves
// Delete curves
QwtPlotCurve
*
curve
=
curves
.
take
(
key
);
QwtPlotCurve
*
curve
=
_
curves
.
take
(
key
);
// Delete the object
// Delete the object
delete
curve
;
delete
curve
;
// Set the pointer null
// Set the pointer null
...
@@ -276,7 +276,7 @@ void LinechartPlot::appendData(QString dataname, quint64 ms, double value)
...
@@ -276,7 +276,7 @@ void LinechartPlot::appendData(QString dataname, quint64 ms, double value)
valueInterval
=
maxValue
-
minValue
;
valueInterval
=
maxValue
-
minValue
;
// Assign dataset to curve
// Assign dataset to curve
QwtPlotCurve
*
curve
=
curves
.
value
(
dataname
);
QwtPlotCurve
*
curve
=
_
curves
.
value
(
dataname
);
curve
->
setRawSamples
(
dataset
->
getPlotX
(),
dataset
->
getPlotY
(),
dataset
->
getPlotCount
());
curve
->
setRawSamples
(
dataset
->
getPlotX
(),
dataset
->
getPlotY
(),
dataset
->
getPlotCount
());
// qDebug() << "mintime" << minTime << "maxtime" << maxTime << "last max time" << "window position" << getWindowPosition();
// qDebug() << "mintime" << minTime << "maxtime" << maxTime << "last max time" << "window position" << getWindowPosition();
...
@@ -321,7 +321,7 @@ void LinechartPlot::addCurve(QString id)
...
@@ -321,7 +321,7 @@ void LinechartPlot::addCurve(QString id)
// Create new curve and set style
// Create new curve and set style
QwtPlotCurve
*
curve
=
new
QwtPlotCurve
(
id
);
QwtPlotCurve
*
curve
=
new
QwtPlotCurve
(
id
);
// Add curve to list
// Add curve to list
curves
.
insert
(
id
,
curve
);
_
curves
.
insert
(
id
,
curve
);
curve
->
setStyle
(
QwtPlotCurve
::
Lines
);
curve
->
setStyle
(
QwtPlotCurve
::
Lines
);
curve
->
setPaintAttribute
(
QwtPlotCurve
::
FilterPoints
,
true
);
curve
->
setPaintAttribute
(
QwtPlotCurve
::
FilterPoints
,
true
);
...
@@ -414,15 +414,15 @@ void LinechartPlot::setScaling(int scaling)
...
@@ -414,15 +414,15 @@ void LinechartPlot::setScaling(int scaling)
**/
**/
void
LinechartPlot
::
setVisibleById
(
QString
id
,
bool
visible
)
void
LinechartPlot
::
setVisibleById
(
QString
id
,
bool
visible
)
{
{
if
(
curves
.
contains
(
id
))
{
if
(
_
curves
.
contains
(
id
))
{
curves
.
value
(
id
)
->
setVisible
(
visible
);
_
curves
.
value
(
id
)
->
setVisible
(
visible
);
if
(
visible
)
if
(
visible
)
{
{
curves
.
value
(
id
)
->
attach
(
this
);
_
curves
.
value
(
id
)
->
attach
(
this
);
}
}
else
else
{
{
curves
.
value
(
id
)
->
detach
();
_
curves
.
value
(
id
)
->
detach
();
}
}
}
}
}
}
...
@@ -467,9 +467,9 @@ void LinechartPlot::showCurve(QString id)
...
@@ -467,9 +467,9 @@ void LinechartPlot::showCurve(QString id)
**/
**/
void
LinechartPlot
::
setCurveColor
(
QString
id
,
QColor
color
)
void
LinechartPlot
::
setCurveColor
(
QString
id
,
QColor
color
)
{
{
QwtPlotCurve
*
curve
=
curves
.
value
(
id
);
QwtPlotCurve
*
curve
=
_
curves
.
value
(
id
);
// Change the color of the curve.
// Change the color of the curve.
curve
->
setPen
(
QPen
(
QBrush
(
color
),
curveWidth
));
curve
->
setPen
(
QPen
(
QBrush
(
color
),
_
curveWidth
));
//qDebug() << "Setting curve" << id << "to" << color;
//qDebug() << "Setting curve" << id << "to" << color;
...
@@ -477,7 +477,7 @@ void LinechartPlot::setCurveColor(QString id, QColor color)
...
@@ -477,7 +477,7 @@ void LinechartPlot::setCurveColor(QString id, QColor color)
const
QwtSymbol
*
oldSymbol
=
curve
->
symbol
();
const
QwtSymbol
*
oldSymbol
=
curve
->
symbol
();
QwtSymbol
*
newSymbol
=
NULL
;
QwtSymbol
*
newSymbol
=
NULL
;
if
(
oldSymbol
)
{
if
(
oldSymbol
)
{
newSymbol
=
new
QwtSymbol
(
oldSymbol
->
style
(),
QBrush
(
color
),
QPen
(
color
,
symbolWidth
),
QSize
(
symbolWidth
,
symbolWidth
));
newSymbol
=
new
QwtSymbol
(
oldSymbol
->
style
(),
QBrush
(
color
),
QPen
(
color
,
_symbolWidth
),
QSize
(
_symbolWidth
,
_
symbolWidth
));
}
}
curve
->
setSymbol
(
newSymbol
);
curve
->
setSymbol
(
newSymbol
);
}
}
...
@@ -490,7 +490,7 @@ void LinechartPlot::setCurveColor(QString id, QColor color)
...
@@ -490,7 +490,7 @@ void LinechartPlot::setCurveColor(QString id, QColor color)
**/
**/
bool
LinechartPlot
::
isVisible
(
QString
id
)
bool
LinechartPlot
::
isVisible
(
QString
id
)
{
{
return
curves
.
value
(
id
)
->
isVisible
();
return
_
curves
.
value
(
id
)
->
isVisible
();
}
}
/**
/**
...
@@ -499,9 +499,9 @@ bool LinechartPlot::isVisible(QString id)
...
@@ -499,9 +499,9 @@ bool LinechartPlot::isVisible(QString id)
bool
LinechartPlot
::
anyCurveVisible
()
bool
LinechartPlot
::
anyCurveVisible
()
{
{
bool
visible
=
false
;
bool
visible
=
false
;
foreach
(
const
QString
&
key
,
curves
.
keys
())
foreach
(
const
QString
&
key
,
_
curves
.
keys
())
{
{
if
(
curves
.
value
(
key
)
->
isVisible
())
if
(
_
curves
.
value
(
key
)
->
isVisible
())
{
{
visible
=
true
;
visible
=
true
;
}
}
...
@@ -530,7 +530,7 @@ void LinechartPlot::setAutoScroll(bool active)
...
@@ -530,7 +530,7 @@ void LinechartPlot::setAutoScroll(bool active)
**/
**/
QList
<
QwtPlotCurve
*>
LinechartPlot
::
getCurves
()
QList
<
QwtPlotCurve
*>
LinechartPlot
::
getCurves
()
{
{
return
curves
.
values
();
return
_
curves
.
values
();
}
}
/**
/**
...
@@ -702,10 +702,10 @@ void LinechartPlot::removeAllData()
...
@@ -702,10 +702,10 @@ void LinechartPlot::removeAllData()
datalock
.
lock
();
datalock
.
lock
();
// Delete curves
// Delete curves
QMap
<
QString
,
QwtPlotCurve
*>::
iterator
i
;
QMap
<
QString
,
QwtPlotCurve
*>::
iterator
i
;
for
(
i
=
curves
.
begin
();
i
!=
curves
.
end
();
++
i
)
for
(
i
=
_curves
.
begin
();
i
!=
_
curves
.
end
();
++
i
)
{
{
// Remove from curve list
// Remove from curve list
QwtPlotCurve
*
curve
=
curves
.
take
(
i
.
key
());
QwtPlotCurve
*
curve
=
_
curves
.
take
(
i
.
key
());
// Delete the object
// Delete the object
delete
curve
;
delete
curve
;
// Set the pointer null
// Set the pointer null
...
...
src/ui/linechart/LinechartWidget.cc
View file @
b8a2ef1b
This diff is collapsed.
Click to expand it.
src/ui/linechart/LinechartWidget.h
View file @
b8a2ef1b
...
@@ -138,7 +138,6 @@ protected:
...
@@ -138,7 +138,6 @@ protected:
QAction
*
addNewCurve
;
///< Add curve candidate to the active curves
QAction
*
addNewCurve
;
///< Add curve candidate to the active curves
QMenu
*
curveMenu
;
QComboBox
*
timeScaleCmb
;
QComboBox
*
timeScaleCmb
;
QToolButton
*
scalingLogButton
;
QToolButton
*
scalingLogButton
;
...
...
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