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)
int count = _values.count();
//-- Arbitrary limit of 1 minute of data at 50Hz for now
if(count < (50 * 60)) {
QPointF p(QGC::groundTimeMilliseconds(), v);
QPointF p(QGC::bootTimeMilliseconds(), v);
_values.append(p);
} else {
if(_dataIndex >= count) _dataIndex = 0;
_values[_dataIndex].setX(QGC::groundTimeMilliseconds());
_values[_dataIndex].setX(QGC::bootTimeMilliseconds());
_values[_dataIndex].setY(v);
_dataIndex++;
}
......@@ -580,7 +580,7 @@ void
MAVLinkChartController::updateXRange()
{
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);
_rangeXMin = QDateTime::fromMSecsSinceEpoch(t - _controller->timeScaleSt()[static_cast<int>(_rangeXIndex)]->timeScale);
emit rangeXMinChanged();
......@@ -849,12 +849,12 @@ MAVLinkInspectorController::deleteChart(MAVLinkChartController* chart)
if(chart) {
for(int i = 0; i < _charts.count(); i++) {
MAVLinkChartController* c = qobject_cast<MAVLinkChartController*>(_charts.get(i));
if(c) {
if(c && c == chart) {
_charts.removeOne(c);
delete c;
break;
}
}
chart->deleteLater();
emit chartsChanged();
}
}
......
......@@ -21,8 +21,7 @@ ChartView {
margins.top: chartHeader.height + (ScreenTools.defaultFontPixelHeight * 2)
property var chartController: null
property int maxSeriesCount: seriesColors.length
property var seriesColors: ["chartreuse", "darkturquoise", "chocolate", "thistle", "silver", "blue"]
property var seriesColors: ["#00E04B","#DE8500","#F32836","#BFBFBF","#536DFF","#EECC44"]
function addDimension(field) {
if(!chartController) {
......@@ -59,6 +58,7 @@ ChartView {
gridVisible: true
labelsFont.family: "Fixed"
labelsFont.pointSize: ScreenTools.smallFontPointSize
labelsColor: qgcPal.text
}
ValueAxis {
......@@ -69,6 +69,7 @@ ChartView {
lineVisible: false
labelsFont.family: "Fixed"
labelsFont.pointSize: ScreenTools.smallFontPointSize
labelsColor: qgcPal.text
}
Row {
......
......@@ -277,6 +277,7 @@ Item {
}
Rectangle {
id: square
width: 100
height: 100
color: qgcPal.text
......@@ -289,4 +290,41 @@ Item {
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