From c61536e737351f7d251c66246ec561ff56e1f7c5 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 1 Jul 2017 16:21:22 +0200 Subject: [PATCH] fixed RsGraphWidget by adding an extra data point in the lower right corner, and fixed typo that caused an invalid point to be drawn --- .../src/gui/common/RSGraphWidget.cpp | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/retroshare-gui/src/gui/common/RSGraphWidget.cpp b/retroshare-gui/src/gui/common/RSGraphWidget.cpp index baf94dd25..ef129809c 100644 --- a/retroshare-gui/src/gui/common/RSGraphWidget.cpp +++ b/retroshare-gui/src/gui/common/RSGraphWidget.cpp @@ -323,15 +323,6 @@ RSGraphWidget::resetGraph() updateIfPossible(); } -/** Toggles display of respective graph lines and counters. */ -//void -//DhtGraph::setShowCounters(bool showRSDHT, bool showALLDHT) -//{ -// _showRSDHT = showRSDHT; -// _showALLDHT = showALLDHT; -// this->update(); -//} - /** Overloads default QWidget::paintEvent. Draws the actual * bandwidth graph. */ void RSGraphWidget::paintEvent(QPaintEvent *) @@ -354,9 +345,11 @@ void RSGraphWidget::paintEvent(QPaintEvent *) /* Paint the scale */ paintScale1(); - /* Plot the rsDHT/allDHT data */ + + /* Plot the data */ paintData(); - /* Paint the rsDHT/allDHT totals */ + + /* Paint the totals */ paintTotals(); // part of the scale that needs to write over the data curves. @@ -427,17 +420,19 @@ void RSGraphWidget::paintData() QColor pcolor = getColor(source.displayName(i).toStdString()) ; - /* Plot the bandwidth data as area graphs */ - if (_flags & RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) - paintIntegral(points, pcolor, _opacity); - - /* Plot the bandwidth as solid lines. If the graph style is currently an - * area graph, we end up outlining the integrals. */ + /* Plot the bandwidth as solid lines. If the graph style is currently an area graph, we end up outlining the integrals. */ if(_flags & RSGRAPH_FLAGS_PAINT_STYLE_DOTS) paintDots(points, pcolor); else paintLine(points, pcolor); + + /* Plot the data as area graphs */ + + points.push_front(QPointF( _rec.width(), _rec.height() - _graph_base)) ; // add a point in the lower right corner, to close the path. + + if (_flags & RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) + paintIntegral(points, pcolor, _opacity); } if(_maxValue > 0.0f) { @@ -520,7 +515,7 @@ void RSGraphWidget::pointsFromData(const std::vector& values,QVector