diff options
author | Titta Heikkala <titta.heikkala@digia.com> | 2013-09-16 13:00:34 +0300 |
---|---|---|
committer | Titta Heikkala <titta.heikkala@digia.com> | 2013-09-16 13:57:45 +0300 |
commit | f23ac19273506f9c0f9847ed336af2c36c202dc2 (patch) | |
tree | 70b46cc9ffe1d0bd2f9bd93ee298d6ac2fc327c5 /src/barchart | |
parent | 66fa88d106401d019172e2cdb6d0de2b2a22df1f (diff) |
Fix logarithmic axis point calculation
For logarithmic axis the geometry point is set even if the point value
is zero or negative. For zero and negative values the x-point is set to
zero and the y-point is set to chart height. This way the bar chart
items can ignore the return value from calculateGeometryPoint() method
and not draw the bar for a value that does not have logarithm defined.
Task-number: QTRD-2065
Change-Id: I7ba4efed6a0678eb487377e3e88bdee9c849a9a3
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/barchart')
6 files changed, 2 insertions, 14 deletions
diff --git a/src/barchart/horizontal/bar/horizontalbarchartitem.cpp b/src/barchart/horizontal/bar/horizontalbarchartitem.cpp index 97d8ecb7..941a1645 100644 --- a/src/barchart/horizontal/bar/horizontalbarchartitem.cpp +++ b/src/barchart/horizontal/bar/horizontalbarchartitem.cpp @@ -81,9 +81,6 @@ QVector<QRectF> HorizontalBarChartItem::calculateLayout() QPointF bottomRight = domain()->calculateGeometryPoint(QPointF(value, category - barWidth / 2 + (set + 1)/setCount * barWidth), m_validData); - if (!m_validData) - return QVector<QRectF>(); - rect.setTopLeft(topLeft); rect.setBottomRight(bottomRight); layout.append(rect.normalized()); diff --git a/src/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp b/src/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp index 9d530e93..0a169ec5 100644 --- a/src/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp +++ b/src/barchart/horizontal/percent/horizontalpercentbarchartitem.cpp @@ -82,8 +82,6 @@ QVector<QRectF> HorizontalPercentBarChartItem::calculateLayout() topLeft = domain()->calculateGeometryPoint(QPointF(set ? 100 * sum/categorySum : 0, category - barWidth/2), m_validData); QPointF bottomRight = domain()->calculateGeometryPoint(QPointF(100 * (value + sum)/categorySum, category + barWidth/2), m_validData); - if (!m_validData) - return QVector<QRectF>(); rect.setTopLeft(topLeft); rect.setBottomRight(bottomRight); layout.append(rect.normalized()); diff --git a/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp b/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp index 0bfe8e6d..a4fad23c 100644 --- a/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp +++ b/src/barchart/horizontal/stacked/horizontalstackedbarchartitem.cpp @@ -92,8 +92,7 @@ QVector<QRectF> HorizontalStackedBarChartItem::calculateLayout() topLeft = domain()->calculateGeometryPoint(QPointF(set ? positiveSum : 0, category + barWidth / 2), m_validData); positiveSum += value; } - if (!m_validData) - return QVector<QRectF>(); + rect.setTopLeft(topLeft); rect.setBottomRight(bottomRight); layout.append(rect.normalized()); diff --git a/src/barchart/vertical/bar/barchartitem.cpp b/src/barchart/vertical/bar/barchartitem.cpp index f5ea55ce..4b948afd 100644 --- a/src/barchart/vertical/bar/barchartitem.cpp +++ b/src/barchart/vertical/bar/barchartitem.cpp @@ -81,9 +81,6 @@ QVector<QRectF> BarChartItem::calculateLayout() else bottomRight = domain()->calculateGeometryPoint(QPointF(category - barWidth / 2 + (set + 1)/(setCount) * barWidth, 0), m_validData); - if (!m_validData) - return QVector<QRectF>(); - rect.setTopLeft(topLeft); rect.setBottomRight(bottomRight); layout.append(rect.normalized()); diff --git a/src/barchart/vertical/percent/percentbarchartitem.cpp b/src/barchart/vertical/percent/percentbarchartitem.cpp index 893b88da..e0e4a4a5 100644 --- a/src/barchart/vertical/percent/percentbarchartitem.cpp +++ b/src/barchart/vertical/percent/percentbarchartitem.cpp @@ -84,8 +84,6 @@ QVector<QRectF> PercentBarChartItem::calculateLayout() else bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth/2, set ? 100 * sum/categorySum : 0), m_validData); - if (!m_validData) - return QVector<QRectF>(); rect.setTopLeft(topLeft); rect.setBottomRight(bottomRight); layout.append(rect.normalized()); diff --git a/src/barchart/vertical/stacked/stackedbarchartitem.cpp b/src/barchart/vertical/stacked/stackedbarchartitem.cpp index 42c2aad3..909d7d50 100644 --- a/src/barchart/vertical/stacked/stackedbarchartitem.cpp +++ b/src/barchart/vertical/stacked/stackedbarchartitem.cpp @@ -93,8 +93,7 @@ QVector<QRectF> StackedBarChartItem::calculateLayout() bottomRight = domain()->calculateGeometryPoint(QPointF(category + barWidth / 2, set ? positiveSum : 0), m_validData); positiveSum += value; } - if (!m_validData) - return QVector<QRectF>(); + rect.setTopLeft(topLeft); rect.setBottomRight(bottomRight); layout.append(rect.normalized()); |