Skip to content

Commit

Permalink
Fixed broken graphs with missing time data handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tumic0 committed Oct 27, 2019
1 parent e6b205e commit a1de3c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/GUI/graphitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ void GraphItem::updateBounds()
}
}

_bounds = QRectF(QPointF(left, top), QPointF(right, bottom));
QRectF bounds(QPointF(left, top), QPointF(right, bottom));
_bounds = bounds.isValid() ? bounds : QRectF();
}

qreal GraphItem::max() const
Expand Down
7 changes: 6 additions & 1 deletion src/GUI/graphview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ void GraphView::setGraphType(GraphType type)
for (int i = 0; i < _graphs.count(); i++) {
GraphItem *gi = _graphs.at(i);
gi->setGraphType(type);
if (gi->bounds().isNull())
removeItem(gi);
else
addItem(gi);
_bounds |= gi->bounds();
}

Expand Down Expand Up @@ -194,7 +198,8 @@ void GraphView::addGraph(GraphItem *graph)
SLOT(emitSliderPositionChanged(qreal)));

_graphs.append(graph);
_scene->addItem(graph);
if (!graph->bounds().isNull())
_scene->addItem(graph);
_bounds |= graph->bounds();

setXUnits();
Expand Down

0 comments on commit a1de3c9

Please sign in to comment.