// SPDX-License-Identifier: GPL-2.0 #ifndef STATS_AXIS_H #define STATS_AXIS_H #include #include #include #include #include #include #include #include class QGraphicsScene; class StatsAxis : public QGraphicsLineItem { public: virtual ~StatsAxis(); // Returns minimum and maximum of shown range, not of data points. std::pair minMax() const; std::pair minMaxScreen() const; // minimum and maximum in screen coordinates double width() const; // Only supported by vertical axes. Only valid after setSize(). double height() const; // Only supported for horizontal axes. Always valid. void setSize(double size); // Width for horizontal and height for vertical. void setPos(QPointF pos); // Must be called after setSize(). void setRange(double, double); // Map x (horizontal) or y (vertical) coordinate to or from screen coordinate double toScreen(double) const; double toValue(double) const; std::vector ticksPositions() const; // Positions in screen coordinates protected: StatsAxis(const QString &title, bool horizontal, bool labelsBetweenTicks); struct Label { std::unique_ptr label; double pos; Label(const QString &name, double pos, QGraphicsScene *scene, const QFont &font); }; std::vector