parent
0b0e33a7b5
commit
4883fa6c43
@ -253,6 +253,15 @@ void LogsModelNg::logsReply(const QVariantMap &data)
|
|||||||
// End the batch at 1 again
|
// End the batch at 1 again
|
||||||
m_graphSeries->append(QPointF(entry->timestamp().addSecs(-1).toMSecsSinceEpoch(), 1));
|
m_graphSeries->append(QPointF(entry->timestamp().addSecs(-1).toMSecsSinceEpoch(), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust min/max
|
||||||
|
if (!newMin.isValid() || newMin > entry->value()) {
|
||||||
|
newMin = 0;
|
||||||
|
}
|
||||||
|
if (!newMax.isValid() || newMax < entry->value()) {
|
||||||
|
newMax = 1;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// if (i > 0) {
|
// if (i > 0) {
|
||||||
// LogEntry *newerEntry = newBlock.at(i - 1);
|
// LogEntry *newerEntry = newBlock.at(i - 1);
|
||||||
@ -268,18 +277,21 @@ void LogsModelNg::logsReply(const QVariantMap &data)
|
|||||||
}
|
}
|
||||||
// qDebug() << "Adding line series point:" << (offset + i) << entry->timestamp().toMSecsSinceEpoch() << (entry->value().toReal());
|
// qDebug() << "Adding line series point:" << (offset + i) << entry->timestamp().toMSecsSinceEpoch() << (entry->value().toReal());
|
||||||
m_graphSeries->append(QPointF(entry->timestamp().toMSecsSinceEpoch(), entry->value().toReal()));
|
m_graphSeries->append(QPointF(entry->timestamp().toMSecsSinceEpoch(), entry->value().toReal()));
|
||||||
|
|
||||||
|
// Adjust min/max
|
||||||
|
if (!newMin.isValid() || newMin > entry->value()) {
|
||||||
|
newMin = entry->value().toReal();
|
||||||
|
}
|
||||||
|
if (!newMax.isValid() || newMax < entry->value()) {
|
||||||
|
newMax = entry->value().toReal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!newMin.isValid() || newMin > entry->value()) {
|
|
||||||
newMin = entry->value().toReal();
|
|
||||||
}
|
|
||||||
if (!newMax.isValid() || newMax < entry->value()) {
|
|
||||||
newMax = entry->value().toReal();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
emit countChanged();
|
emit countChanged();
|
||||||
// qDebug() << "min" << m_minValue << "max" << m_maxValue << "newMin" << newMin << "newMax" << newMax;
|
|
||||||
|
qDebug() << "min" << m_minValue << "max" << m_maxValue << "newMin" << newMin << "newMax" << newMax;
|
||||||
if (m_minValue != newMin) {
|
if (m_minValue != newMin) {
|
||||||
m_minValue = newMin;
|
m_minValue = newMin;
|
||||||
emit minValueChanged();
|
emit minValueChanged();
|
||||||
|
|||||||
@ -104,8 +104,17 @@ Item {
|
|||||||
|
|
||||||
ValueAxis {
|
ValueAxis {
|
||||||
id: yAxis
|
id: yAxis
|
||||||
max: Math.ceil(logsModelNg.maxValue + Math.abs(logsModelNg.maxValue * .05))
|
max: {
|
||||||
|
switch (root.stateType.type.toLowerCase()) {
|
||||||
|
case "bool":
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
Math.ceil(logsModelNg.maxValue + Math.abs(logsModelNg.maxValue * .05))
|
||||||
|
}
|
||||||
|
}
|
||||||
min: Math.floor(logsModelNg.minValue - Math.abs(logsModelNg.minValue * .05))
|
min: Math.floor(logsModelNg.minValue - Math.abs(logsModelNg.minValue * .05))
|
||||||
|
onMinChanged: print("min set to", min)
|
||||||
|
onMaxChanged: print("max set to", min)
|
||||||
labelsFont.pixelSize: app.smallFont
|
labelsFont.pixelSize: app.smallFont
|
||||||
labelFormat: {
|
labelFormat: {
|
||||||
switch (root.stateType.type.toLowerCase()) {
|
switch (root.stateType.type.toLowerCase()) {
|
||||||
@ -241,6 +250,7 @@ Item {
|
|||||||
id: lineSeries1
|
id: lineSeries1
|
||||||
onPointAdded: {
|
onPointAdded: {
|
||||||
var newPoint = lineSeries1.at(index)
|
var newPoint = lineSeries1.at(index)
|
||||||
|
print("pointadded", newPoint.x, newPoint.y)
|
||||||
|
|
||||||
if (newPoint.x > lineSeries0.at(0).x) {
|
if (newPoint.x > lineSeries0.at(0).x) {
|
||||||
lineSeries0.replace(0, newPoint.x, 0)
|
lineSeries0.replace(0, newPoint.x, 0)
|
||||||
@ -254,7 +264,6 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var diffMaxToNew = newPoint.x - xAxis.max.getTime();
|
var diffMaxToNew = newPoint.x - xAxis.max.getTime();
|
||||||
print("diffToNew is", diffMaxToNew)
|
|
||||||
if (diffMaxToNew < 1000 * 60 * 5) {
|
if (diffMaxToNew < 1000 * 60 * 5) {
|
||||||
chartView.animationOptions = ChartView.NoAnimation
|
chartView.animationOptions = ChartView.NoAnimation
|
||||||
var newMin = xAxis.min.getTime() + diffMaxToNew;
|
var newMin = xAxis.min.getTime() + diffMaxToNew;
|
||||||
@ -262,6 +271,7 @@ Item {
|
|||||||
xAxis.min = new Date(newMin)
|
xAxis.min = new Date(newMin)
|
||||||
chartView.animationOptions = ChartView.SeriesAnimations
|
chartView.animationOptions = ChartView.SeriesAnimations
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
color: Qt.rgba(root.color.r, root.color.g, root.color.b, .3)
|
color: Qt.rgba(root.color.r, root.color.g, root.color.b, .3)
|
||||||
|
|||||||
Reference in New Issue
Block a user