From 4fa1dedc5aa74db198ea97e460a5f86e2fa0c5ab 2012-08-23 11:21:09 From: sauimone Date: 2012-08-23 11:21:09 Subject: [PATCH] fix to baranimations leaving crap on screen with negative bars --- diff --git a/examples/populationpyramid/main.cpp b/examples/populationpyramid/main.cpp index 5b26b9d..658e0f7 100644 --- a/examples/populationpyramid/main.cpp +++ b/examples/populationpyramid/main.cpp @@ -70,6 +70,7 @@ int main(int argc, char *argv[]) QBarCategoryAxis* axis = new QBarCategoryAxis(); axis->append(categories); chart->setAxisY(axis,series); + chart->axisX(series)->setRange(-210000,210000); //![4] //![5] diff --git a/src/animations/baranimation.cpp b/src/animations/baranimation.cpp index 60a7d3a..a16a26d 100644 --- a/src/animations/baranimation.cpp +++ b/src/animations/baranimation.cpp @@ -51,7 +51,7 @@ QVariant BarAnimation::interpolated(const QVariant &from, const QVariant &to, qr qreal y = endVector[i].topLeft().y() + endVector[i].height() - h; QRectF value(x,y,w,h); - result << value; + result << value.normalized(); } return qVariantFromValue(result); } diff --git a/src/animations/horizontalbaranimation.cpp b/src/animations/horizontalbaranimation.cpp index e21f93d..eda9e05 100644 --- a/src/animations/horizontalbaranimation.cpp +++ b/src/animations/horizontalbaranimation.cpp @@ -52,7 +52,7 @@ QVariant HorizontalBarAnimation::interpolated(const QVariant &from, const QVaria qreal y = endVector[i].top(); QRectF value(x,y,w,h); - result << value; + result << value.normalized(); } return qVariantFromValue(result); } diff --git a/src/animations/horizontalpercentbaranimation.cpp b/src/animations/horizontalpercentbaranimation.cpp index fffcc8c..8783d43 100644 --- a/src/animations/horizontalpercentbaranimation.cpp +++ b/src/animations/horizontalpercentbaranimation.cpp @@ -54,7 +54,7 @@ QVariant HorizontalPercentBarAnimation::interpolated(const QVariant &from, const qreal y = endVector[i].top(); QRectF value(x,y,w,h); - result << value; + result << value.normalized(); } return qVariantFromValue(result); } diff --git a/src/animations/horizontalstackedbaranimation.cpp b/src/animations/horizontalstackedbaranimation.cpp index 66635ee..c2034a7 100644 --- a/src/animations/horizontalstackedbaranimation.cpp +++ b/src/animations/horizontalstackedbaranimation.cpp @@ -54,7 +54,7 @@ QVariant HorizontalStackedBarAnimation::interpolated(const QVariant &from, const qreal y = endVector[i].top(); QRectF value(x,y,w,h); - result << value; + result << value.normalized(); } return qVariantFromValue(result); } diff --git a/src/animations/percentbaranimation.cpp b/src/animations/percentbaranimation.cpp index 74132ed..9266aa0 100644 --- a/src/animations/percentbaranimation.cpp +++ b/src/animations/percentbaranimation.cpp @@ -54,7 +54,7 @@ QVariant PercentBarAnimation::interpolated(const QVariant &from, const QVariant qreal y = yAxis + ((endVector[i].topLeft().y() - yAxis) * progress); QRectF value(x,y,w,h); - result << value; + result << value.normalized(); } return qVariantFromValue(result); } diff --git a/src/animations/stackedbaranimation.cpp b/src/animations/stackedbaranimation.cpp index 347a7bb..a0b4b82 100644 --- a/src/animations/stackedbaranimation.cpp +++ b/src/animations/stackedbaranimation.cpp @@ -53,7 +53,7 @@ QVariant StackedBarAnimation::interpolated(const QVariant &from, const QVariant qreal y = yAxis + ((endVector[i].topLeft().y() - yAxis) * progress); QRectF value(x,y,w,h); - result << value; + result << value.normalized(); } return qVariantFromValue(result); }