Skip to content

Commit b020d58

Browse files
committed
Fix: Chart ranges set too large sometimes
1 parent 6e13149 commit b020d58

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/stats/stats_engine.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,6 @@ void ItemStatsEngine::updateTimeScatterChart(TimeScatterChart& chart, QList<Date
968968

969969
for (const BufferRowIndex& targetBufferIndex : targetBufferRows) {
970970
QDateTime dateTime;
971-
QDate date;
972971
QList<qreal> yValues = QList<qreal>(allSeries.size(), -1);
973972

974973
// Check cache
@@ -995,15 +994,18 @@ void ItemStatsEngine::updateTimeScatterChart(TimeScatterChart& chart, QList<Date
995994
}
996995

997996
// Append data and update minima/maxima
997+
bool dataPointAppended = false;
998998
for (int i = 0; i < allSeries.size(); i++) {
999999
const int yValue = yValues.at(i);
10001000
if (Q_UNLIKELY(yValue == -1)) continue;
10011001

10021002
allSeries[i]->data.append({dateTime, yValue});
1003+
dataPointAppended = true;
10031004
if (Q_UNLIKELY(yValue > maxY)) maxY = yValue;
10041005
}
1006+
if (!dataPointAppended) continue;
10051007

1006-
date = dateTime.date();
1008+
const QDate date = dateTime.date();
10071009
if (Q_UNLIKELY(date < minDate || !minDate.isValid())) minDate = date;
10081010
if (Q_UNLIKELY(date > maxDate || !maxDate.isValid())) maxDate = date;
10091011
}

0 commit comments

Comments
 (0)