profile: generalize tick generation

The number of ticks was generated for each axis with custom
code. This code was not aware of the size of the profile and
could result in overly dense or sparse ticks.

Generalize the generation of the ticks. For now, round tick
values to integers. In the future, try to use more "nice"
looking values as we do for the statistics tab.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-09-26 19:10:39 +02:00 committed by Dirk Hohndel
parent 177df72d33
commit 0de40a85b7
4 changed files with 46 additions and 77 deletions

View file

@ -38,7 +38,6 @@ public:
~DiveCartesianAxis();
void setBounds(double min, double max);
void setTransform(double a, double b = 0.0);
void setTickInterval(double interval);
void setOrientation(Orientation orientation);
double minimum() const;
double maximum() const;
@ -49,7 +48,7 @@ public:
void setTextVisible(bool arg1);
void setLinesVisible(bool arg1);
void setLine(const QLineF &line);
virtual void updateTicks(int animSpeed);
void updateTicks(int animSpeed);
double width() const; // only for vertical axes
double height() const; // only for horizontal axes
@ -68,9 +67,8 @@ protected:
Orientation orientation;
QList<DiveTextItem *> labels;
QList<DiveLineItem *> lines;
double min;
double max;
double interval;
double dataMin, dataMax;
double min, max;
bool textVisibility;
bool lineVisibility;
double labelScale;
@ -101,7 +99,6 @@ class TimeAxis : public DiveCartesianAxis {
Q_OBJECT
public:
using DiveCartesianAxis::DiveCartesianAxis;
void updateTicks(int animSpeed) override;
private:
QString textForValue(double value) const override;
QColor colorForValue(double value) const override;