Commit 05e7be62 authored by Gus Grubba's avatar Gus Grubba Committed by Lorenz Meier

Fix chart deletion error

Tweak chart colors
parent 0f66f2f2
...@@ -97,11 +97,11 @@ QGCMAVLinkMessageField::updateValue(QString newValue, qreal v) ...@@ -97,11 +97,11 @@ QGCMAVLinkMessageField::updateValue(QString newValue, qreal v)
int count = _values.count(); int count = _values.count();
//-- Arbitrary limit of 1 minute of data at 50Hz for now //-- Arbitrary limit of 1 minute of data at 50Hz for now
if(count < (50 * 60)) { if(count < (50 * 60)) {
QPointF p(QGC::groundTimeMilliseconds(), v); QPointF p(QGC::bootTimeMilliseconds(), v);
_values.append(p); _values.append(p);
} else { } else {
if(_dataIndex >= count) _dataIndex = 0; if(_dataIndex >= count) _dataIndex = 0;
_values[_dataIndex].setX(QGC::groundTimeMilliseconds()); _values[_dataIndex].setX(QGC::bootTimeMilliseconds());
_values[_dataIndex].setY(v); _values[_dataIndex].setY(v);
_dataIndex++; _dataIndex++;
} }
...@@ -580,7 +580,7 @@ void ...@@ -580,7 +580,7 @@ void
MAVLinkChartController::updateXRange() MAVLinkChartController::updateXRange()
{ {
if(_rangeXIndex < static_cast<quint32>(_controller->timeScaleSt().count())) { if(_rangeXIndex < static_cast<quint32>(_controller->timeScaleSt().count())) {
qint64 t = static_cast<qint64>(QGC::groundTimeMilliseconds()); qint64 t = static_cast<qint64>(QGC::bootTimeMilliseconds());
_rangeXMax = QDateTime::fromMSecsSinceEpoch(t); _rangeXMax = QDateTime::fromMSecsSinceEpoch(t);
_rangeXMin = QDateTime::fromMSecsSinceEpoch(t - _controller->timeScaleSt()[static_cast<int>(_rangeXIndex)]->timeScale); _rangeXMin = QDateTime::fromMSecsSinceEpoch(t - _controller->timeScaleSt()[static_cast<int>(_rangeXIndex)]->timeScale);
emit rangeXMinChanged(); emit rangeXMinChanged();
...@@ -849,12 +849,12 @@ MAVLinkInspectorController::deleteChart(MAVLinkChartController* chart) ...@@ -849,12 +849,12 @@ MAVLinkInspectorController::deleteChart(MAVLinkChartController* chart)
if(chart) { if(chart) {
for(int i = 0; i < _charts.count(); i++) { for(int i = 0; i < _charts.count(); i++) {
MAVLinkChartController* c = qobject_cast<MAVLinkChartController*>(_charts.get(i)); MAVLinkChartController* c = qobject_cast<MAVLinkChartController*>(_charts.get(i));
if(c) { if(c && c == chart) {
_charts.removeOne(c); _charts.removeOne(c);
delete c;
break; break;
} }
} }
chart->deleteLater();
emit chartsChanged(); emit chartsChanged();
} }
} }
......
...@@ -21,8 +21,7 @@ ChartView { ...@@ -21,8 +21,7 @@ ChartView {
margins.top: chartHeader.height + (ScreenTools.defaultFontPixelHeight * 2) margins.top: chartHeader.height + (ScreenTools.defaultFontPixelHeight * 2)
property var chartController: null property var chartController: null
property int maxSeriesCount: seriesColors.length property var seriesColors: ["#00E04B","#DE8500","#F32836","#BFBFBF","#536DFF","#EECC44"]
property var seriesColors: ["chartreuse", "darkturquoise", "chocolate", "thistle", "silver", "blue"]
function addDimension(field) { function addDimension(field) {
if(!chartController) { if(!chartController) {
...@@ -59,6 +58,7 @@ ChartView { ...@@ -59,6 +58,7 @@ ChartView {
gridVisible: true gridVisible: true
labelsFont.family: "Fixed" labelsFont.family: "Fixed"
labelsFont.pointSize: ScreenTools.smallFontPointSize labelsFont.pointSize: ScreenTools.smallFontPointSize
labelsColor: qgcPal.text
} }
ValueAxis { ValueAxis {
...@@ -69,6 +69,7 @@ ChartView { ...@@ -69,6 +69,7 @@ ChartView {
lineVisible: false lineVisible: false
labelsFont.family: "Fixed" labelsFont.family: "Fixed"
labelsFont.pointSize: ScreenTools.smallFontPointSize labelsFont.pointSize: ScreenTools.smallFontPointSize
labelsColor: qgcPal.text
} }
Row { Row {
......
...@@ -277,6 +277,7 @@ Item { ...@@ -277,6 +277,7 @@ Item {
} }
Rectangle { Rectangle {
id: square
width: 100 width: 100
height: 100 height: 100
color: qgcPal.text color: qgcPal.text
...@@ -289,4 +290,41 @@ Item { ...@@ -289,4 +290,41 @@ Item {
color: qgcPal.window color: qgcPal.window
} }
} }
Component.onCompleted: {
for (var i = 10; i < 360; i = i + 60) {
var colorValue = Qt.hsla(i/360, 0.85, 0.5, 1);
seriesColors.push(colorValue)
colorListModel.append({"colorValue": colorValue.toString()})
}
}
property var seriesColors: []
ListModel {
id: colorListModel
}
Column {
width: 100
spacing: 0
anchors.right: square.left
anchors.bottom: parent.bottom
anchors.margins: 10
Repeater {
model: colorListModel
delegate: Rectangle {
width: 100
height: 100 / 6
color: colorValue
Text {
text: colorValue
color: "#202020"
font.pointSize: _textMeasure.font.pointSize * 0.75
anchors.centerIn: parent
}
}
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment