2022-01-18 12:56:05 +03:00
|
|
|
#ifndef AXISDATA_H
|
|
|
|
#define AXISDATA_H
|
|
|
|
|
2022-03-09 01:44:49 +03:00
|
|
|
#include <QObject>
|
2022-01-18 12:56:05 +03:00
|
|
|
|
|
|
|
namespace LimeReport {
|
2022-03-09 01:44:49 +03:00
|
|
|
class AxisData : public QObject
|
2022-01-18 12:56:05 +03:00
|
|
|
{
|
2022-03-09 01:44:49 +03:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(bool reverseDirection READ reverseDirection WRITE setReverseDirection)
|
|
|
|
Q_PROPERTY(bool calculateAxisScale READ calculateAxisScale WRITE setCalculateAxisScale)
|
|
|
|
Q_PROPERTY(bool isStepAutomatic READ isStepAutomatic WRITE setIsStepAutomatic)
|
|
|
|
Q_PROPERTY(bool isMinimumAutomatic READ isMinimumAutomatic WRITE setIsMinimumAutomatic)
|
|
|
|
Q_PROPERTY(bool isMaximumAutomatic READ isMaximumAutomatic WRITE setIsMaximumAutomatic)
|
|
|
|
Q_PROPERTY(qreal manualStep READ manualStep WRITE setManualStep)
|
|
|
|
Q_PROPERTY(qreal manualMinimum READ manualMinimum WRITE setManualMinimum)
|
|
|
|
Q_PROPERTY(qreal manualMaximum READ manualMaximum WRITE setManualMaximum)
|
2022-01-18 12:56:05 +03:00
|
|
|
public:
|
2022-03-14 00:49:39 +03:00
|
|
|
enum AxisType {
|
|
|
|
YAxis = 0,
|
|
|
|
XAxis = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
AxisData(AxisType type, QObject *parent = nullptr);
|
2022-03-09 01:44:49 +03:00
|
|
|
|
2022-03-13 09:26:25 +03:00
|
|
|
QString toString() const;
|
2022-03-09 01:44:49 +03:00
|
|
|
void copy(AxisData *other);
|
|
|
|
void update();
|
|
|
|
void update(qreal minValue, qreal maxValue);
|
2022-03-10 22:35:48 +03:00
|
|
|
void updateForDesignMode();
|
2022-01-18 12:56:05 +03:00
|
|
|
|
|
|
|
int segmentCount() const;
|
|
|
|
|
|
|
|
qreal rangeMin() const;
|
|
|
|
qreal rangeMax() const;
|
|
|
|
|
|
|
|
qreal minValue() const;
|
|
|
|
qreal maxValue() const;
|
|
|
|
qreal step() const;
|
|
|
|
|
|
|
|
qreal delta() const;
|
2022-01-25 21:28:32 +03:00
|
|
|
|
2022-03-09 01:44:49 +03:00
|
|
|
bool reverseDirection() const;
|
|
|
|
void setReverseDirection(bool newReverseDirection);
|
|
|
|
bool calculateAxisScale() const;
|
|
|
|
void setCalculateAxisScale(bool newCalculateAxisScale);
|
|
|
|
|
|
|
|
qreal manualMaximum() const;
|
|
|
|
void setManualMaximum(qreal newManualMaximum);
|
|
|
|
|
|
|
|
qreal manualMinimum() const;
|
|
|
|
void setManualMinimum(qreal newManualMinimum);
|
|
|
|
|
|
|
|
qreal manualStep() const;
|
|
|
|
void setManualStep(qreal newManualStep);
|
|
|
|
|
|
|
|
bool isMaximumAutomatic() const;
|
|
|
|
void setIsMaximumAutomatic(bool newIsMaximumAutomatic);
|
|
|
|
|
|
|
|
bool isMinimumAutomatic() const;
|
|
|
|
void setIsMinimumAutomatic(bool newIsMinimumAutomatic);
|
|
|
|
|
|
|
|
bool isStepAutomatic() const;
|
|
|
|
void setIsStepAutomatic(bool newIsStepAutomatic);
|
|
|
|
|
2022-03-14 00:49:39 +03:00
|
|
|
AxisType type() const;
|
|
|
|
|
2022-01-18 12:56:05 +03:00
|
|
|
private:
|
2022-03-09 01:44:49 +03:00
|
|
|
void calculateRoundedAxisScale();
|
|
|
|
void calculateSimpleAxisScale();
|
|
|
|
qreal calculateNewMinimum(qreal min, qreal step) const;
|
|
|
|
qreal calculateNewMaximum(qreal max, qreal step) const;
|
2022-01-18 12:56:05 +03:00
|
|
|
|
|
|
|
qreal m_rangeMin;
|
|
|
|
qreal m_rangeMax;
|
|
|
|
qreal m_minValue;
|
|
|
|
qreal m_maxValue;
|
|
|
|
qreal m_step;
|
|
|
|
qreal m_delta;
|
|
|
|
int m_segmentCount;
|
2022-03-09 01:44:49 +03:00
|
|
|
bool m_calculateAxisScale;
|
|
|
|
bool m_reverseDirection;
|
|
|
|
qreal m_manualMaximum;
|
|
|
|
qreal m_manualMinimum;
|
|
|
|
qreal m_manualStep;
|
|
|
|
bool m_isMaximumAutomatic;
|
|
|
|
bool m_isMinimumAutomatic;
|
|
|
|
bool m_isStepAutomatic;
|
2022-03-14 00:49:39 +03:00
|
|
|
const AxisType m_type;
|
2022-01-18 12:56:05 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // AXISDATA_H
|