![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
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 } |
Public Types inherited from QCPAxisTicker | |
| enum | TickStepStrategy { tssReadability , tssMeetTickCount } |
Public Member Functions | |
| QCPAxisTickerPi () | |
| QString | piSymbol () const |
| double | piValue () const |
| bool | periodicity () const |
| FractionStyle | fractionStyle () const |
| void | setPiSymbol (QString symbol) |
| void | setPiValue (double pi) |
| void | setPeriodicity (int multiplesOfPi) |
| void | setFractionStyle (FractionStyle style) |
Public Member Functions inherited from QCPAxisTicker | |
| QCPAxisTicker () | |
| virtual | ~QCPAxisTicker () |
| TickStepStrategy | tickStepStrategy () const |
| int | tickCount () const |
| double | tickOrigin () const |
| void | setTickStepStrategy (TickStepStrategy strategy) |
| void | setTickCount (int count) |
| void | setTickOrigin (double origin) |
| virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
Protected Member Functions | |
| virtual double | getTickStep (const QCPRange &range) |
| virtual int | getSubTickCount (double tickStep) |
| virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) |
| void | simplifyFraction (int &numerator, int &denominator) const |
| QString | fractionToString (int numerator, int denominator) const |
| QString | unicodeFraction (int numerator, int denominator) const |
| QString | unicodeSuperscript (int number) const |
| QString | unicodeSubscript (int number) const |
Protected Member Functions inherited from QCPAxisTicker | |
| virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) |
| virtual QVector< double > | createSubTickVector (int subTickCount, const QVector< double > &ticks) |
| virtual QVector< QString > | createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision) |
| void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
| double | pickClosest (double target, const QVector< double > &candidates) const |
| double | getMantissa (double input, double *magnitude=0) const |
| double | cleanMantissa (double input) const |
Protected Attributes | |
| QString | mPiSymbol |
| double | mPiValue |
| int | mPeriodicity |
| FractionStyle | mFractionStyle |
| double | mPiTickStep |
Protected Attributes inherited from QCPAxisTicker | |
| TickStepStrategy | mTickStepStrategy |
| int | mTickCount |
| double | mTickOrigin |
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:
axistickerpi-creation
Definition at line 2103 of file qcustomplot.h.
Defines how fractions should be displayed in tick labels.
Definition at line 2111 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 6897 of file qcustomplot.cpp.
References QCPAxisTicker::setTickCount().
|
inline |
Definition at line 2130 of file qcustomplot.h.
|
protected |
Definition at line 7050 of file qcustomplot.cpp.
References fsAsciiFractions, fsFloatingPoint, fsUnicodeFractions, mFractionStyle, and unicodeFraction().
Referenced by getTickLabel().
|
protectedvirtual |
Reimplemented from QCPAxisTicker.
Definition at line 6970 of file qcustomplot.cpp.
References QCPAxisTicker::getSubTickCount(), and mPiValue.
|
protectedvirtual |
Reimplemented from QCPAxisTicker.
Definition at line 6982 of file qcustomplot.cpp.
References fractionToString(), fsFloatingPoint, QCPAxisTicker::getTickLabel(), mFractionStyle, mPeriodicity, mPiSymbol, mPiTickStep, mPiValue, and simplifyFraction().
|
protectedvirtual |
Reimplemented from QCPAxisTicker.
Definition at line 6952 of file qcustomplot.cpp.
References QCPAxisTicker::cleanMantissa(), e, mPiTickStep, mPiValue, QCPAxisTicker::mTickCount, and QCPRange::size().
|
inline |
Definition at line 2129 of file qcustomplot.h.
|
inline |
Definition at line 2127 of file qcustomplot.h.
|
inline |
Definition at line 2128 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 6940 of file qcustomplot.cpp.
References mFractionStyle.
| 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 6932 of file qcustomplot.cpp.
References mPeriodicity.
| 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 6913 of file qcustomplot.cpp.
References mPiSymbol.
| 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 6921 of file qcustomplot.cpp.
References mPiValue.
|
protected |
Definition at line 7023 of file qcustomplot.cpp.
Referenced by getTickLabel().
|
protected |
Definition at line 7109 of file qcustomplot.cpp.
References unicodeSubscript(), and unicodeSuperscript().
Referenced by fractionToString().
|
protected |
Definition at line 7153 of file qcustomplot.cpp.
References result.
Referenced by unicodeFraction().
|
protected |
Definition at line 7119 of file qcustomplot.cpp.
References result.
Referenced by unicodeFraction().
|
protected |
Definition at line 2143 of file qcustomplot.h.
Referenced by fractionToString(), getTickLabel(), and setFractionStyle().
|
protected |
Definition at line 2142 of file qcustomplot.h.
Referenced by getTickLabel(), and setPeriodicity().
|
protected |
Definition at line 2140 of file qcustomplot.h.
Referenced by getTickLabel(), and setPiSymbol().
|
protected |
Definition at line 2146 of file qcustomplot.h.
Referenced by getTickLabel(), and getTickStep().
|
protected |
Definition at line 2141 of file qcustomplot.h.
Referenced by getSubTickCount(), getTickLabel(), getTickStep(), and setPiValue().