// SPDX-License-Identifier: GPL-2.0 #ifndef STATS_AXIS_H #define STATS_AXIS_H #include #include #include #include #include #include #include #include namespace QtCharts { class QChart; } class StatsAxis : 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(QtCharts::QChart *chart, const QString &title, bool horizontal, bool labelsBetweenTicks); QtCharts::QChart *chart; struct Label { std::unique_ptr label; double pos; Label(const QString &name, double pos, QtCharts::QChart *chart, const QFont &font); }; std::vector