Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi. More...
#include <qcustomplot.h>
Public Types | |
enum | FractionStyle { fsFloatingPoint, fsAsciiFractions, fsUnicodeFractions } |
![]() | |
enum | TickStepStrategy { tssReadability, tssMeetTickCount } |
Public Member Functions | |
FractionStyle | fractionStyle () const |
bool | periodicity () const |
QString | piSymbol () const |
double | piValue () const |
QCPAxisTickerPi () | |
void | setFractionStyle (FractionStyle style) |
void | setPeriodicity (int multiplesOfPi) |
void | setPiSymbol (QString symbol) |
void | setPiValue (double pi) |
![]() | |
virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
QCPAxisTicker () | |
void | setTickCount (int count) |
void | setTickOrigin (double origin) |
void | setTickStepStrategy (TickStepStrategy strategy) |
int | tickCount () const |
double | tickOrigin () const |
TickStepStrategy | tickStepStrategy () const |
virtual | ~QCPAxisTicker () |
Protected Member Functions | |
QString | fractionToString (int numerator, int denominator) const |
virtual int | getSubTickCount (double tickStep) Q_DECL_OVERRIDE |
virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE |
virtual double | getTickStep (const QCPRange &range) Q_DECL_OVERRIDE |
void | simplifyFraction (int &numerator, int &denominator) const |
QString | unicodeFraction (int numerator, int denominator) const |
QString | unicodeSubscript (int number) const |
QString | unicodeSuperscript (int number) const |
![]() | |
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=0) const |
double | pickClosest (double target, const QVector< double > &candidates) const |
void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
Protected Attributes | |
FractionStyle | mFractionStyle |
int | mPeriodicity |
QString | mPiSymbol |
double | mPiTickStep |
double | mPiValue |
![]() | |
int | mTickCount |
double | mTickOrigin |
TickStepStrategy | mTickStepStrategy |
Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi.
This QCPAxisTicker subclass generates ticks that are expressed with respect to a given symbolic constant with a numerical value specified with setPiValue and an appearance in the tick labels specified with setPiSymbol.
Ticks may be generated at fractions of the symbolic constant. How these fractions appear in the tick label can be configured with setFractionStyle.
The ticker can be created and assigned to an axis like this:
Definition at line 1776 of file qcustomplot.h.
Defines how fractions should be displayed in tick labels.
Definition at line 1785 of file qcustomplot.h.
QCPAxisTickerPi::QCPAxisTickerPi | ( | ) |
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 6740 of file qcustomplot.cpp.
|
inline |
Definition at line 1797 of file qcustomplot.h.
|
protected |
Definition at line 6893 of file qcustomplot.cpp.
|
protectedvirtual |
Reimplemented from QCPAxisTicker.
Definition at line 6818 of file qcustomplot.cpp.
|
protectedvirtual |
Reimplemented from QCPAxisTicker.
Definition at line 6831 of file qcustomplot.cpp.
|
protectedvirtual |
Reimplemented from QCPAxisTicker.
Definition at line 6803 of file qcustomplot.cpp.
|
inline |
Definition at line 1796 of file qcustomplot.h.
|
inline |
Definition at line 1794 of file qcustomplot.h.
|
inline |
Definition at line 1795 of file qcustomplot.h.
void QCPAxisTickerPi::setFractionStyle | ( | QCPAxisTickerPi::FractionStyle | style | ) |
Sets how the numerical/fractional part preceding the symbolic constant is displayed in tick labels. See FractionStyle for the various options.
Definition at line 6790 of file qcustomplot.cpp.
void QCPAxisTickerPi::setPeriodicity | ( | int | multiplesOfPi | ) |
Sets whether the axis labels shall appear periodicly and if so, at which multiplicity of the symbolic constant.
To disable periodicity, set multiplesOfPi to zero.
For example, an axis that identifies 0 with 2pi would set multiplesOfPi to two.
Definition at line 6781 of file qcustomplot.cpp.
void QCPAxisTickerPi::setPiSymbol | ( | QString | symbol | ) |
Sets how the symbol part (which is always a suffix to the number) shall appear in the axis tick label.
If a space shall appear between the number and the symbol, make sure the space is contained in symbol.
Definition at line 6757 of file qcustomplot.cpp.
void QCPAxisTickerPi::setPiValue | ( | double | pi | ) |
Sets the numerical value that the symbolic constant has.
This will be used to place the appropriate fractions of the symbol at the respective axis coordinates.
Definition at line 6768 of file qcustomplot.cpp.
|
protected |
Definition at line 6866 of file qcustomplot.cpp.
|
protected |
Definition at line 6949 of file qcustomplot.cpp.
|
protected |
Definition at line 6985 of file qcustomplot.cpp.
|
protected |
Definition at line 6959 of file qcustomplot.cpp.
|
protected |
Definition at line 1810 of file qcustomplot.h.
|
protected |
Definition at line 1809 of file qcustomplot.h.
|
protected |
Definition at line 1807 of file qcustomplot.h.
|
protected |
Definition at line 1813 of file qcustomplot.h.
|
protected |
Definition at line 1808 of file qcustomplot.h.