QCPAxisTickerFixed
Public Types | |
enum | ScaleStrategy { ssNone , ssMultiples , ssPowers } |
Public Types inherited from QCPAxisTicker | |
enum | TickStepStrategy { tssReadability , tssMeetTickCount } |
Public Member Functions | |
QCPAxisTickerFixed () | |
ScaleStrategy | scaleStrategy () const |
void | setScaleStrategy (ScaleStrategy strategy) |
void | setTickStep (double step) |
double | tickStep () const |
Public Member Functions inherited from QCPAxisTicker | |
QCPAxisTicker () | |
virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
void | setTickCount (int count) |
void | setTickOrigin (double origin) |
void | setTickStepStrategy (TickStepStrategy strategy) |
int | tickCount () const |
double | tickOrigin () const |
TickStepStrategy | tickStepStrategy () const |
Protected Member Functions | |
virtual double | getTickStep (const QCPRange &range) override |
Protected Member Functions inherited from QCPAxisTicker | |
double | cleanMantissa (double input) const |
virtual QVector< QString > | createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision) |
virtual QVector< double > | createSubTickVector (int subTickCount, const QVector< double > &ticks) |
virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) |
double | getMantissa (double input, double *magnitude=nullptr) const |
virtual int | getSubTickCount (double tickStep) |
virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) |
double | pickClosest (double target, const QVector< double > &candidates) const |
void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
Protected Attributes | |
ScaleStrategy | mScaleStrategy |
double | mTickStep |
Protected Attributes inherited from QCPAxisTicker | |
int | mTickCount |
double | mTickOrigin |
TickStepStrategy | mTickStepStrategy |
Detailed Description
Specialized axis ticker with a fixed tick step.
This QCPAxisTicker subclass generates ticks with a fixed tick step set with setTickStep. It is also possible to allow integer multiples and integer powers of the specified tick step with setScaleStrategy.
A typical application of this ticker is to make an axis only display integers, by setting the tick step of the ticker to 1.0 and the scale strategy to ssMultiples.
Another case is when a certain number has a special meaning and axis ticks should only appear at multiples of that value. In this case you might also want to consider QCPAxisTickerPi because despite the name it is not limited to only pi symbols/values.
The ticker can be created and assigned to an axis like this:
Definition at line 1898 of file qcustomplot.h.
Member Enumeration Documentation
◆ ScaleStrategy
Defines how the axis ticker may modify the specified tick step (setTickStep) in order to control the number of ticks in the axis range.
- See also
- setScaleStrategy
Enumerator | |
---|---|
ssNone | Modifications are not allowed, the specified tick step is absolutely fixed. This might cause a high tick density and overlapping labels if the axis range is zoomed out. |
ssMultiples | An integer multiple of the specified tick step is allowed. The used factor follows the base class properties of setTickStepStrategy and setTickCount. |
ssPowers | An integer power of the specified tick step is allowed. |
Definition at line 1908 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPAxisTickerFixed()
QCPAxisTickerFixed::QCPAxisTickerFixed | ( | ) |
Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker.
Definition at line 7116 of file qcustomplot.cpp.
Member Function Documentation
◆ getTickStep()
|
overrideprotectedvirtual |
Determines the actually used tick step from the specified tick step and scale strategy (setTickStep, setScaleStrategy).
This method either returns the specified tick step exactly, or, if the scale strategy is not ssNone, a modification of it to allow varying the number of ticks in the current axis range.
\seebaseclassmethod
Reimplemented from QCPAxisTicker.
Definition at line 7161 of file qcustomplot.cpp.
◆ scaleStrategy()
|
inline |
Definition at line 1918 of file qcustomplot.h.
◆ setScaleStrategy()
void QCPAxisTickerFixed::setScaleStrategy | ( | QCPAxisTickerFixed::ScaleStrategy | strategy | ) |
Sets whether the specified tick step (setTickStep) is absolutely fixed or whether modifications may be applied to it before calculating the finally used tick step, such as permitting multiples or powers. See ScaleStrategy for details.
The default strategy is ssNone, which means the tick step is absolutely fixed.
Definition at line 7146 of file qcustomplot.cpp.
◆ setTickStep()
void QCPAxisTickerFixed::setTickStep | ( | double | step | ) |
Sets the fixed tick interval to step.
The axis ticker will only use this tick step when generating axis ticks. This might cause a very high tick density and overlapping labels if the axis range is zoomed out. Using setScaleStrategy it is possible to relax the fixed step and also allow multiples or powers of step. This will enable the ticker to reduce the number of ticks to a reasonable amount (see setTickCount).
Definition at line 7131 of file qcustomplot.cpp.
◆ tickStep()
|
inline |
Definition at line 1917 of file qcustomplot.h.
Member Data Documentation
◆ mScaleStrategy
|
protected |
Definition at line 1927 of file qcustomplot.h.
◆ mTickStep
|
protected |
Definition at line 1926 of file qcustomplot.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:53:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.