// 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; 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; protected: StatsAxis(QtCharts::QChart *chart, 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