diff options
Diffstat (limited to 'stats')
-rw-r--r-- | stats/barseries.cpp | 2 | ||||
-rw-r--r-- | stats/chartitem.cpp | 21 | ||||
-rw-r--r-- | stats/chartitem.h | 3 |
3 files changed, 9 insertions, 17 deletions
diff --git a/stats/barseries.cpp b/stats/barseries.cpp index facdcae6c..2779a59c2 100644 --- a/stats/barseries.cpp +++ b/stats/barseries.cpp @@ -248,7 +248,7 @@ std::vector<BarSeries::SubItem> BarSeries::makeSubItems(std::vector<SubItemDesc> for (auto &[v, dives, label]: items) { if (v > 0.0) { bool selected = std::all_of(dives.begin(), dives.end(), [] (const dive *d) { return d->selected; }); - res.push_back({ view.createChartItem<ChartBarItem>(ChartZValue::Series, barBorderWidth, horizontal), + res.push_back({ view.createChartItem<ChartBarItem>(ChartZValue::Series, barBorderWidth), std::move(dives), {}, from, from + v, bin_nr, selected }); if (!label.empty()) diff --git a/stats/chartitem.cpp b/stats/chartitem.cpp index 5aa45be13..1a93de0c9 100644 --- a/stats/chartitem.cpp +++ b/stats/chartitem.cpp @@ -402,8 +402,8 @@ void ChartRectLineItem::render() positionDirty = materialDirty = false; } -ChartBarItem::ChartBarItem(StatsView &v, ChartZValue z, double borderWidth, bool horizontal) : HideableChartItem(v, z), - borderWidth(borderWidth), selected(false), horizontal(horizontal), +ChartBarItem::ChartBarItem(StatsView &v, ChartZValue z, double borderWidth) : HideableChartItem(v, z), + borderWidth(borderWidth), selected(false), positionDirty(false), colorDirty(false), selectedDirty(false) { } @@ -453,17 +453,10 @@ void ChartBarItem::render() if (positionDirty) { node->node->setRect(rect); auto vertices = borderGeometry->vertexDataAsPoint2D(); - if (horizontal) { - setPoint(vertices[0], rect.topLeft()); - setPoint(vertices[1], rect.topRight()); - setPoint(vertices[2], rect.bottomRight()); - setPoint(vertices[3], rect.bottomLeft()); - } else { - setPoint(vertices[0], rect.bottomLeft()); - setPoint(vertices[1], rect.topLeft()); - setPoint(vertices[2], rect.topRight()); - setPoint(vertices[3], rect.bottomRight()); - } + setPoint(vertices[0], rect.topLeft()); + setPoint(vertices[1], rect.topRight()); + setPoint(vertices[2], rect.bottomRight()); + setPoint(vertices[3], rect.bottomLeft()); node->node->markDirty(QSGNode::DirtyGeometry); borderNode->markDirty(QSGNode::DirtyGeometry); } @@ -540,7 +533,7 @@ QRectF ChartBarItem::getRect() const } ChartBoxItem::ChartBoxItem(StatsView &v, ChartZValue z, double borderWidth) : - ChartBarItem(v, z, borderWidth, false) // Only support for vertical boxes + ChartBarItem(v, z, borderWidth) { } diff --git a/stats/chartitem.h b/stats/chartitem.h index 87fb0f993..ca04d6afd 100644 --- a/stats/chartitem.h +++ b/stats/chartitem.h @@ -145,7 +145,7 @@ public: // A bar in a bar chart: a rectangle bordered by lines. class ChartBarItem : public HideableChartProxyItem<QSGRectangleNode> { public: - ChartBarItem(StatsView &v, ChartZValue z, double borderWidth, bool horizontal); + ChartBarItem(StatsView &v, ChartZValue z, double borderWidth); ~ChartBarItem(); void setColor(QColor color, QColor borderColor); void setRect(const QRectF &rect); @@ -157,7 +157,6 @@ protected: double borderWidth; QRectF rect; bool selected; - bool horizontal; bool positionDirty; bool colorDirty; bool selectedDirty; |