From 62012f19906751eabe377e650892cc128588e941 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Thu, 5 Aug 2021 18:05:51 +0100 Subject: [PATCH] Fix Overview BubbleViz refresh bug .. since axis min and max values were not initialised the visualisation would fail to refresh and was generally unpredictable. .. we now set initial values and check when updating. --- src/Charts/OverviewItems.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Charts/OverviewItems.cpp b/src/Charts/OverviewItems.cpp index 2406e7967..33419c72c 100644 --- a/src/Charts/OverviewItems.cpp +++ b/src/Charts/OverviewItems.cpp @@ -2054,7 +2054,6 @@ IntervalOverviewItem::setDateRange(DateRange dr) first = false; } - // set scale double ydiff = (maxy-miny) / 10.0f; if (miny >= 0 && ydiff > miny) miny = ydiff; @@ -3826,6 +3825,8 @@ BubbleViz::BubbleViz(IntervalOverviewItem *parent, QString name) : QGraphicsItem transitionAnimation=new QPropertyAnimation(this, "transition"); group->addAnimation(transitionAnimation); + + minx=maxx=miny=maxy=-1; // initial values } BubbleViz::~BubbleViz() @@ -3906,6 +3907,14 @@ bool scoresBiggerThan(const BubbleVizTuple i1, const BubbleVizTuple i2) void BubbleViz::setPoints(QList p, double minx, double maxx, double miny, double maxy) { + // initial conditions? + if (this->miny == -1 && this->maxy == -1 && this->minx == -1 && this->maxx == -1) { + this->minx=minx; + this->miny=miny; + this->maxy=maxy; + this->maxx=maxx; + } + xaxisAnimation->setStartValue(QPointF(this->minx,this->maxx)); xaxisAnimation->setEndValue(QPointF(minx,maxx)); yaxisAnimation->setStartValue(QPointF(this->miny,this->maxy)); @@ -4124,6 +4133,7 @@ BubbleViz::paint(QPainter*painter, const QStyleOptionGraphicsItem *, QWidget*) } } else { + // when transition is -1 we are rescaling the axes first int index=0; foreach(BPointF point, oldpoints) {