some fixes
This commit is contained in:
parent
b6e46613ae
commit
a3a33595d5
@ -226,12 +226,20 @@ void LogsModelNg::logsReply(const QVariantMap &data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_graphSeries->count() == 0) {
|
if (m_graphSeries->count() == 0) {
|
||||||
|
// If it's the first one, make sure we add an ending point at 1
|
||||||
qDebug() << "Adding bool line series point:" << QDateTime::currentDateTime() << QDateTime::currentDateTime().toMSecsSinceEpoch() - 1 << (entry->value().toBool() ? 1 : 0) << "(beginning)";
|
qDebug() << "Adding bool line series point:" << QDateTime::currentDateTime() << QDateTime::currentDateTime().toMSecsSinceEpoch() - 1 << (entry->value().toBool() ? 1 : 0) << "(beginning)";
|
||||||
m_graphSeries->append(QPointF(QDateTime::currentDateTime().toMSecsSinceEpoch(), 1));// entry->value().toBool() ? 1 : 0));
|
m_graphSeries->append(QPointF(QDateTime::currentDateTime().toMSecsSinceEpoch(), 1));
|
||||||
m_graphSeries->append(QPointF(QDateTime::currentDateTime().toMSecsSinceEpoch(), entry->value().toBool() ? 1 : 0));
|
m_graphSeries->append(QPointF(QDateTime::currentDateTime().toMSecsSinceEpoch(), entry->value().toBool() ? 1 : 0));
|
||||||
|
} else if (i == 0) {
|
||||||
|
// Adding a new batch... remove the last appended 1 from the previous batch
|
||||||
|
m_graphSeries->remove(m_graphSeries->count() - 1);
|
||||||
}
|
}
|
||||||
qDebug() << "Adding bool line series point:" << entry->timestamp() << entry->timestamp().toMSecsSinceEpoch() << (entry->value().toBool() ? 1 : 0);
|
qDebug() << "Adding bool line series point:" << entry->timestamp() << entry->timestamp().toMSecsSinceEpoch() << (entry->value().toBool() ? 1 : 0);
|
||||||
m_graphSeries->append(QPointF(entry->timestamp().toMSecsSinceEpoch(), entry->value().toBool() ? 1 : 0));
|
m_graphSeries->append(QPointF(entry->timestamp().toMSecsSinceEpoch(), entry->value().toBool() ? 1 : 0));
|
||||||
|
if (i == newBlock.count() - 1) {
|
||||||
|
// End the batch at 1 again
|
||||||
|
m_graphSeries->append(QPointF(entry->timestamp().addSecs(-1).toMSecsSinceEpoch(), 1));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// if (i > 0) {
|
// if (i > 0) {
|
||||||
// LogEntry *newerEntry = newBlock.at(i - 1);
|
// LogEntry *newerEntry = newBlock.at(i - 1);
|
||||||
|
|||||||
@ -62,16 +62,16 @@ Item {
|
|||||||
HeaderButton {
|
HeaderButton {
|
||||||
imageSource: "../images/zoom-out.svg"
|
imageSource: "../images/zoom-out.svg"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var newTime = new Date(xAxis.min.getTime() - (xAxis.timeDiff / 4))
|
var newTime = new Date(xAxis.min.getTime() - (xAxis.timeDiff * 1000 / 4))
|
||||||
xAxis.min = newTime;
|
xAxis.min = newTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HeaderButton {
|
HeaderButton {
|
||||||
imageSource: "../images/zoom-in.svg"
|
imageSource: "../images/zoom-in.svg"
|
||||||
enabled: xAxis.timeDiff > (1000 * 60 * 30)
|
enabled: xAxis.timeDiff > (60 * 30)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var newTime = new Date(Math.min(xAxis.min.getTime() + (xAxis.timeDiff / 4), xAxis.max.getTime() - (1000 * 60 * 30)))
|
var newTime = new Date(Math.min(xAxis.min.getTime() + (xAxis.timeDiff * 1000 / 4), xAxis.max.getTime() - (1000 * 60 * 30)))
|
||||||
xAxis.min = newTime;
|
xAxis.min = newTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,8 +94,8 @@ Item {
|
|||||||
|
|
||||||
ValueAxis {
|
ValueAxis {
|
||||||
id: yAxis
|
id: yAxis
|
||||||
min: logsModelNg.minValue - logsModelNg.minValue * .01
|
min: logsModelNg.minValue - logsModelNg.minValue * .05
|
||||||
max: logsModelNg.maxValue + logsModelNg.maxValue * .01
|
max: logsModelNg.maxValue + logsModelNg.maxValue * .05
|
||||||
labelsFont.pixelSize: app.smallFont
|
labelsFont.pixelSize: app.smallFont
|
||||||
labelsColor: app.foregroundColor
|
labelsColor: app.foregroundColor
|
||||||
tickCount: chartView.height / 40
|
tickCount: chartView.height / 40
|
||||||
@ -117,10 +117,11 @@ Item {
|
|||||||
tickCount: chartView.width / 70
|
tickCount: chartView.width / 70
|
||||||
labelsFont.pixelSize: app.smallFont
|
labelsFont.pixelSize: app.smallFont
|
||||||
labelsColor: app.foregroundColor
|
labelsColor: app.foregroundColor
|
||||||
property int timeDiff: xAxis.max.getTime() - xAxis.min.getTime()
|
property int timeDiff: (xAxis.max.getTime() - xAxis.min.getTime()) / 1000
|
||||||
|
onTimeDiffChanged: print("timeDiff is:", timeDiff)
|
||||||
|
|
||||||
function getTimeSpanString() {
|
function getTimeSpanString() {
|
||||||
var td = timeDiff / 1000
|
var td = timeDiff
|
||||||
if (td < 60) {
|
if (td < 60) {
|
||||||
return qsTr("%1 seconds").arg(Math.round(td));
|
return qsTr("%1 seconds").arg(Math.round(td));
|
||||||
}
|
}
|
||||||
@ -158,19 +159,19 @@ Item {
|
|||||||
}
|
}
|
||||||
titleBrush: app.foregroundColor
|
titleBrush: app.foregroundColor
|
||||||
format: {
|
format: {
|
||||||
if (timeDiff < 1000 * 60) { // one minute
|
if (timeDiff < 60) { // one minute
|
||||||
return "mm:ss"
|
return "mm:ss"
|
||||||
}
|
}
|
||||||
if (timeDiff < 1000 * 60 * 60) { // one hour
|
if (timeDiff < 60 * 60) { // one hour
|
||||||
return "hh:mm"
|
return "hh:mm"
|
||||||
}
|
}
|
||||||
if (timeDiff < 1000 * 60 * 60 * 24 * 2) { // two day
|
if (timeDiff < 60 * 60 * 24 * 2) { // two day
|
||||||
return "hh:mm"
|
return "hh:mm"
|
||||||
}
|
}
|
||||||
if (timeDiff < 1000 * 60 * 60 * 24 * 7) { // one week
|
if (timeDiff < 60 * 60 * 24 * 7) { // one week
|
||||||
return "ddd hh:mm"
|
return "ddd hh:mm"
|
||||||
}
|
}
|
||||||
if (timeDiff < 1000 * 60 * 60 * 24 * 7 * 30) { // one month
|
if (timeDiff < 60 * 60 * 24 * 7 * 30) { // one month
|
||||||
return "dd.MM."
|
return "dd.MM."
|
||||||
}
|
}
|
||||||
return "MMM yy"
|
return "MMM yy"
|
||||||
@ -198,6 +199,7 @@ Item {
|
|||||||
id: connectedLineSeries
|
id: connectedLineSeries
|
||||||
}
|
}
|
||||||
color: "#55ff0000"
|
color: "#55ff0000"
|
||||||
|
borderWidth: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
AreaSeries {
|
AreaSeries {
|
||||||
@ -256,8 +258,15 @@ Item {
|
|||||||
pointLabelsColor: app.foregroundColor
|
pointLabelsColor: app.foregroundColor
|
||||||
pointLabelsFont.pixelSize: app.smallFont
|
pointLabelsFont.pixelSize: app.smallFont
|
||||||
pointLabelsFormat: "@yPoint"
|
pointLabelsFormat: "@yPoint"
|
||||||
|
pointLabelsClipping: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BusyIndicator {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: logsModelNg.busy
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
property int lastX: 0
|
property int lastX: 0
|
||||||
@ -285,13 +294,15 @@ Item {
|
|||||||
chartView.animationOptions = ChartView.NoAnimation
|
chartView.animationOptions = ChartView.NoAnimation
|
||||||
var oldMax = xAxis.max;
|
var oldMax = xAxis.max;
|
||||||
chartView.scrollRight(dy);
|
chartView.scrollRight(dy);
|
||||||
xAxis.min = new Date(xAxis.min.getTime() - xAxis.timeDiff * 2)
|
xAxis.min = new Date(xAxis.min.getTime() - xAxis.timeDiff * 1000 * 2)
|
||||||
chartView.animationOptions = ChartView.SeriesAnimations
|
chartView.animationOptions = ChartView.SeriesAnimations
|
||||||
}
|
}
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
lastX = mouse.x
|
lastX = mouse.x
|
||||||
lastY = mouse.y
|
lastY = mouse.y
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
var pt = chartView.mapToValue(Qt.point(mouse.x, mouse.y), mainSeries)
|
var pt = chartView.mapToValue(Qt.point(mouse.x, mouse.y), mainSeries)
|
||||||
mainSeries.markClosestPoint(pt)
|
mainSeries.markClosestPoint(pt)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,8 @@ Page {
|
|||||||
case "Int":
|
case "Int":
|
||||||
case "Double":
|
case "Double":
|
||||||
return true;
|
return true;
|
||||||
|
case "Bool":
|
||||||
|
return engine.jsonRpcClient.ensureServerVersion("1.10")
|
||||||
}
|
}
|
||||||
print("not showing graph for", root.stateType.type)
|
print("not showing graph for", root.stateType.type)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user