Manages a single axis inside a QCustomPlot. More...
#include <qcustomplot.h>
Public Types | |
enum | AxisType { atLeft = 0x01, atRight = 0x02, atTop = 0x04, atBottom = 0x08 } |
enum | LabelSide { lsInside, lsOutside } |
enum | ScaleType { stLinear, stLogarithmic } |
enum | SelectablePart { spNone = 0, spAxis = 0x001, spTickLabels = 0x002, spAxisLabel = 0x004 } |
Signals | |
void | rangeChanged (const QCPRange &newRange) |
void | rangeChanged (const QCPRange &newRange, const QCPRange &oldRange) |
void | scaleTypeChanged (QCPAxis::ScaleType scaleType) |
void | selectableChanged (const QCPAxis::SelectableParts &parts) |
void | selectionChanged (const QCPAxis::SelectableParts &parts) |
![]() | |
void | layerChanged (QCPLayer *newLayer) |
Public Member Functions | |
QCPAxisRect * | axisRect () const |
AxisType | axisType () const |
QPen | basePen () const |
double | coordToPixel (double value) const |
SelectablePart | getPartAt (const QPointF &pos) const |
QList< QCPGraph * > | graphs () const |
QCPGrid * | grid () const |
QList< QCPAbstractItem * > | items () const |
QString | label () const |
QColor | labelColor () const |
QFont | labelFont () const |
int | labelPadding () const |
QCPLineEnding | lowerEnding () const |
void | moveRange (double diff) |
QString | numberFormat () const |
int | numberPrecision () const |
int | offset () const |
Qt::Orientation | orientation () const |
int | padding () const |
int | pixelOrientation () const |
double | pixelToCoord (double value) const |
QList< QCPAbstractPlottable * > | plottables () const |
QCPAxis (QCPAxisRect *parent, AxisType type) | |
const QCPRange | range () const |
bool | rangeReversed () const |
void | rescale (bool onlyVisiblePlottables=false) |
void | scaleRange (double factor) |
void | scaleRange (double factor, double center) |
ScaleType | scaleType () const |
SelectableParts | selectableParts () const |
QPen | selectedBasePen () const |
QColor | selectedLabelColor () const |
QFont | selectedLabelFont () const |
SelectableParts | selectedParts () const |
QPen | selectedSubTickPen () const |
QColor | selectedTickLabelColor () const |
QFont | selectedTickLabelFont () const |
QPen | selectedTickPen () const |
virtual double | selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE |
void | setBasePen (const QPen &pen) |
void | setLabel (const QString &str) |
void | setLabelColor (const QColor &color) |
void | setLabelFont (const QFont &font) |
void | setLabelPadding (int padding) |
void | setLowerEnding (const QCPLineEnding &ending) |
void | setNumberFormat (const QString &formatCode) |
void | setNumberPrecision (int precision) |
void | setOffset (int offset) |
void | setPadding (int padding) |
Q_SLOT void | setRange (const QCPRange &range) |
void | setRange (double lower, double upper) |
void | setRange (double position, double size, Qt::AlignmentFlag alignment) |
void | setRangeLower (double lower) |
void | setRangeReversed (bool reversed) |
void | setRangeUpper (double upper) |
void | setScaleRatio (const QCPAxis *otherAxis, double ratio=1.0) |
Q_SLOT void | setScaleType (QCPAxis::ScaleType type) |
Q_SLOT void | setSelectableParts (const QCPAxis::SelectableParts &selectableParts) |
void | setSelectedBasePen (const QPen &pen) |
void | setSelectedLabelColor (const QColor &color) |
void | setSelectedLabelFont (const QFont &font) |
Q_SLOT void | setSelectedParts (const QCPAxis::SelectableParts &selectedParts) |
void | setSelectedSubTickPen (const QPen &pen) |
void | setSelectedTickLabelColor (const QColor &color) |
void | setSelectedTickLabelFont (const QFont &font) |
void | setSelectedTickPen (const QPen &pen) |
void | setSubTickLength (int inside, int outside=0) |
void | setSubTickLengthIn (int inside) |
void | setSubTickLengthOut (int outside) |
void | setSubTickPen (const QPen &pen) |
void | setSubTicks (bool show) |
void | setTicker (QSharedPointer< QCPAxisTicker > ticker) |
void | setTickLabelColor (const QColor &color) |
void | setTickLabelFont (const QFont &font) |
void | setTickLabelPadding (int padding) |
void | setTickLabelRotation (double degrees) |
void | setTickLabels (bool show) |
void | setTickLabelSide (LabelSide side) |
void | setTickLength (int inside, int outside=0) |
void | setTickLengthIn (int inside) |
void | setTickLengthOut (int outside) |
void | setTickPen (const QPen &pen) |
void | setTicks (bool show) |
void | setUpperEnding (const QCPLineEnding &ending) |
int | subTickLengthIn () const |
int | subTickLengthOut () const |
QPen | subTickPen () const |
bool | subTicks () const |
QSharedPointer< QCPAxisTicker > | ticker () const |
QColor | tickLabelColor () const |
QFont | tickLabelFont () const |
int | tickLabelPadding () const |
double | tickLabelRotation () const |
bool | tickLabels () const |
LabelSide | tickLabelSide () const |
int | tickLengthIn () const |
int | tickLengthOut () const |
QPen | tickPen () const |
bool | ticks () const |
QVector< double > | tickVector () const |
QVector< QString > | tickVectorLabels () const |
QCPLineEnding | upperEnding () const |
virtual | ~QCPAxis () |
![]() | |
bool | antialiased () const |
QCPLayer * | layer () const |
QCPLayerable * | parentLayerable () const |
QCustomPlot * | parentPlot () const |
QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0) | |
bool | realVisibility () const |
void | setAntialiased (bool enabled) |
Q_SLOT bool | setLayer (QCPLayer *layer) |
bool | setLayer (const QString &layerName) |
void | setVisible (bool on) |
bool | visible () const |
virtual | ~QCPLayerable () |
Static Public Member Functions | |
static AxisType | marginSideToAxisType (QCP::MarginSide side) |
static AxisType | opposite (AxisType type) |
static Qt::Orientation | orientation (AxisType type) |
Protected Member Functions | |
virtual void | applyDefaultAntialiasingHint (QCPPainter *painter) const Q_DECL_OVERRIDE |
virtual int | calculateMargin () |
virtual void | deselectEvent (bool *selectionStateChanged) Q_DECL_OVERRIDE |
virtual void | draw (QCPPainter *painter) Q_DECL_OVERRIDE |
QPen | getBasePen () const |
QColor | getLabelColor () const |
QFont | getLabelFont () const |
QPen | getSubTickPen () const |
QColor | getTickLabelColor () const |
QFont | getTickLabelFont () const |
QPen | getTickPen () const |
virtual void | mouseMoveEvent (QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE |
virtual void | mousePressEvent (QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE |
virtual void | mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE |
virtual void | selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE |
virtual QCP::Interaction | selectionCategory () const Q_DECL_OVERRIDE |
void | setupTickVectors () |
virtual void | wheelEvent (QWheelEvent *event) Q_DECL_OVERRIDE |
![]() | |
void | applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const |
virtual QRect | clipRect () const |
void | initializeParentPlot (QCustomPlot *parentPlot) |
virtual void | mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details) |
bool | moveToLayer (QCPLayer *layer, bool prepend) |
virtual void | parentPlotInitialized (QCustomPlot *parentPlot) |
void | setParentLayerable (QCPLayerable *parentLayerable) |
Friends | |
class | QCPAxisRect |
class | QCPGrid |
class | QCustomPlot |
Manages a single axis inside a QCustomPlot.
Usually doesn't need to be instantiated externally. Access QCustomPlot's default four axes via QCustomPlot::xAxis (bottom), QCustomPlot::yAxis (left), QCustomPlot::xAxis2 (top) and QCustomPlot::yAxis2 (right).
Axes are always part of an axis rect, see QCPAxisRect.
Each axis holds an instance of QCPAxisTicker which is used to generate the tick coordinates and tick labels. You can access the currently installed ticker or set a new one (possibly one of the specialized subclasses, or your own subclass) via setTicker. For details, see the documentation of QCPAxisTicker.
Definition at line 1919 of file qcustomplot.h.
enum QCPAxis::AxisType |
Defines at which side of the axis rect the axis will appear. This also affects how the tick marks are drawn, on which side the labels are placed etc.
Definition at line 1972 of file qcustomplot.h.
enum QCPAxis::LabelSide |
Defines on which side of the axis the tick labels (numbers) shall appear.
Enumerator | |
---|---|
lsInside | Tick labels will be displayed inside the axis rect and clipped to the inner axis rect. |
lsOutside | Tick labels will be displayed outside the axis rect. |
Definition at line 1985 of file qcustomplot.h.
enum QCPAxis::ScaleType |
Defines the scale of an axis.
Enumerator | |
---|---|
stLinear | Linear scaling. |
stLogarithmic | Logarithmic scaling with correspondingly transformed axis coordinates (possibly also setTicker to a QCPAxisTickerLog instance). |
Definition at line 1993 of file qcustomplot.h.
Defines the selectable parts of an axis.
Enumerator | |
---|---|
spNone | None of the selectable parts. |
spAxis | The axis backbone and tick marks. |
spTickLabels | Tick labels (numbers) of this axis (as a whole, not individually) |
spAxisLabel | The axis label. |
Definition at line 2001 of file qcustomplot.h.
|
explicit |
Constructs an Axis instance of Type type for the axis rect parent.
Usually it isn't necessary to instantiate axes directly, because you can let QCustomPlot create them for you with QCPAxisRect::addAxis. If you want to use own QCPAxis-subclasses however, create them manually and then inject them also via QCPAxisRect::addAxis.
Definition at line 7506 of file qcustomplot.cpp.
|
virtual |
Definition at line 7574 of file qcustomplot.cpp.
|
protectedvirtual |
Implements QCPLayerable.
Definition at line 8956 of file qcustomplot.cpp.
|
inline |
Definition at line 2015 of file qcustomplot.h.
|
inline |
Definition at line 2014 of file qcustomplot.h.
|
inline |
Definition at line 2036 of file qcustomplot.h.
|
protectedvirtual |
Definition at line 9117 of file qcustomplot.cpp.
double QCPAxis::coordToPixel | ( | double | value | ) | const |
Transforms value, in coordinates of the axis, to pixel coordinates of the QCustomPlot widget.
Definition at line 8604 of file qcustomplot.cpp.
|
protectedvirtual |
Reimplemented from QCPLayerable.
Definition at line 8802 of file qcustomplot.cpp.
|
protectedvirtual |
Implements QCPLayerable.
Definition at line 8967 of file qcustomplot.cpp.
|
protected |
Definition at line 9038 of file qcustomplot.cpp.
|
protected |
Definition at line 9098 of file qcustomplot.cpp.
|
protected |
Definition at line 9078 of file qcustomplot.cpp.
QCPAxis::SelectablePart QCPAxis::getPartAt | ( | const QPointF & | pos | ) | const |
Returns the part of the axis that is hit by pos (in pixels). The return value of this function is independent of the user-selectable parts defined with setSelectableParts. Further, this function does not change the current selection state of the axis.
If the axis is not visible (setVisible), this function always returns spNone.
Definition at line 8662 of file qcustomplot.cpp.
|
protected |
Definition at line 9058 of file qcustomplot.cpp.
|
protected |
Definition at line 9088 of file qcustomplot.cpp.
|
protected |
Definition at line 9068 of file qcustomplot.cpp.
|
protected |
Definition at line 9048 of file qcustomplot.cpp.
QList< QCPGraph * > QCPAxis::graphs | ( | ) | const |
Returns a list of all the graphs that have this axis as key or value axis.
Definition at line 8715 of file qcustomplot.cpp.
|
inline |
Returns the QCPGrid instance belonging to this axis. Access it to set details about the way the grid is displayed.
Definition at line 2056 of file qcustomplot.h.
QList< QCPAbstractItem * > QCPAxis::items | ( | ) | const |
Returns a list of all the items that are associated with this axis. An item is considered associated with an axis if at least one of its positions uses the axis as key or value axis.
Definition at line 8734 of file qcustomplot.cpp.
|
inline |
Definition at line 2041 of file qcustomplot.h.
|
inline |
Definition at line 2040 of file qcustomplot.h.
|
inline |
Definition at line 2039 of file qcustomplot.h.
int QCPAxis::labelPadding | ( | ) | const |
Definition at line 7637 of file qcustomplot.cpp.
QCPLineEnding QCPAxis::lowerEnding | ( | ) | const |
Definition at line 7649 of file qcustomplot.cpp.
|
static |
Transforms a margin side to the logically corresponding axis type. (QCP::msLeft to QCPAxis::atLeft, QCP::msRight to QCPAxis::atRight, etc.)
Definition at line 8758 of file qcustomplot.cpp.
|
protectedvirtual |
This event gets called when the user moves the mouse while holding a mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent.
The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos()
. The parameter startPos indicates the position where the initial mousePressEvent occured, that started the mouse interaction.
The default implementation does nothing.
Reimplemented from QCPLayerable.
Definition at line 8863 of file qcustomplot.cpp.
|
protectedvirtual |
This event gets called when the user presses a mouse button while the cursor is over the layerable. Whether a cursor is over the layerable is decided by a preceding call to selectTest.
The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos()
. The parameter details contains layerable-specific details about the hit, which were generated in the previous call to selectTest. For example, One-dimensional plottables like QCPGraph or QCPBars convey the clicked data point in the details parameter, as QCPDataSelection packed as QVariant. Multi-part objects convey the specific SelectablePart
that was hit (e.g. QCPAxis::SelectablePart in the case of axes).
QCustomPlot uses an event propagation system that works the same as Qt's system. If your layerable doesn't reimplement the mousePressEvent or explicitly calls event->ignore()
in its reimplementation, the event will be propagated to the next layerable in the stacking order.
Once a layerable has accepted the mousePressEvent, it is considered the mouse grabber and will receive all following calls to mouseMoveEvent or mouseReleaseEvent for this mouse interaction (a "mouse interaction" in this context ends with the release).
The default implementation does nothing except explicitly ignoring the event with event->ignore()
.
Reimplemented from QCPLayerable.
Definition at line 8825 of file qcustomplot.cpp.
|
protectedvirtual |
This event gets called when the user releases the mouse button, after this layerable has become the mouse grabber by accepting the preceding mousePressEvent.
The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos()
. The parameter startPos indicates the position where the initial mousePressEvent occured, that started the mouse interaction.
The default implementation does nothing.
Reimplemented from QCPLayerable.
Definition at line 8897 of file qcustomplot.cpp.
void QCPAxis::moveRange | ( | double | diff | ) |
If the scale type (setScaleType) is stLinear, diff is added to the lower and upper bounds of the range. The range is simply moved by diff.
If the scale type is stLogarithmic, the range bounds are multiplied by diff. This corresponds to an apparent "linear" move in logarithmic scaling by a distance of log(diff).
Definition at line 8415 of file qcustomplot.cpp.
QString QCPAxis::numberFormat | ( | ) | const |
Definition at line 7599 of file qcustomplot.cpp.
|
inline |
Definition at line 2028 of file qcustomplot.h.
int QCPAxis::offset | ( | ) | const |
Definition at line 7643 of file qcustomplot.cpp.
|
static |
Returns the axis type that describes the opposite axis of an axis with the specified type.
Definition at line 8775 of file qcustomplot.cpp.
|
inline |
Returns the orientation of this axis. The axis orientation (horizontal or vertical) is deduced from the axis type (left, top, right or bottom).
Definition at line 2108 of file qcustomplot.h.
|
inlinestatic |
Returns the orientation of the specified axis type
Definition at line 2123 of file qcustomplot.h.
|
inline |
Definition at line 2043 of file qcustomplot.h.
|
inline |
Returns which direction points towards higher coordinate values/keys, in pixel space.
This method returns either 1 or -1. If it returns 1, then going in the positive direction along the orientation of the axis in pixels corresponds to going from lower to higher axis coordinates. On the other hand, if this method returns -1, going to smaller pixel values corresponds to going from lower to higher axis coordinates.
For example, this is useful to easily shift axis coordinates by a certain amount given in pixels, without having to care about reversed or vertically aligned axes:
newKey will then contain a key that is ten pixels towards higher keys, starting from oldKey.
Definition at line 2109 of file qcustomplot.h.
double QCPAxis::pixelToCoord | ( | double | value | ) | const |
Transforms value, in pixel coordinates of the QCustomPlot widget, to axis coordinates.
Definition at line 8566 of file qcustomplot.cpp.
QList< QCPAbstractPlottable * > QCPAxis::plottables | ( | ) | const |
|
inline |
Definition at line 2017 of file qcustomplot.h.
|
signal |
This signal is emitted when the range of this axis has changed. You can connect it to the setRange slot of another axis to communicate the new range to the other axis, in order for it to be synchronized.
You may also manipulate/correct the range with setRange in a slot connected to this signal. This is useful if for example a maximum range span shall not be exceeded, or if the lower/upper range shouldn't go beyond certain values (see QCPRange::bounded). For example, the following slot would limit the x axis to ranges between 0 and 10:
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Additionally to the new range, this signal also provides the previous range held by the axis as oldRange.
|
inline |
Definition at line 2018 of file qcustomplot.h.
void QCPAxis::rescale | ( | bool | onlyVisiblePlottables = false | ) |
Changes the axis range such that all plottables associated with this axis are fully visible in that dimension.
Definition at line 8517 of file qcustomplot.cpp.
void QCPAxis::scaleRange | ( | double | factor | ) |
Scales the range of this axis by factor around the center of the current axis range. For example, if factor is 2.0, then the axis range will double its size, and the point at the axis range center won't have changed its position in the QCustomPlot widget (i.e. coordinates around the center will have moved symmetrically closer).
If you wish to scale around a different coordinate than the current axis range center, use the overload scaleRange(double factor, double center).
Definition at line 8440 of file qcustomplot.cpp.
void QCPAxis::scaleRange | ( | double | factor, |
double | center | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Scales the range of this axis by factor around the coordinate center. For example, if factor is 2.0, center is 1.0, then the axis range will double its size, and the point at coordinate 1.0 won't have changed its position in the QCustomPlot widget (i.e. coordinates around 1.0 will have moved symmetrically closer to 1.0).
Definition at line 8454 of file qcustomplot.cpp.
|
inline |
Definition at line 2016 of file qcustomplot.h.
|
signal |
This signal is emitted when the scale type changes, by calls to setScaleType
|
signal |
This signal is emitted when the selectability changes, by calls to setSelectableParts
|
inline |
Definition at line 2046 of file qcustomplot.h.
|
inline |
Definition at line 2051 of file qcustomplot.h.
|
inline |
Definition at line 2050 of file qcustomplot.h.
|
inline |
Definition at line 2048 of file qcustomplot.h.
|
inline |
Definition at line 2045 of file qcustomplot.h.
|
inline |
Definition at line 2053 of file qcustomplot.h.
|
inline |
Definition at line 2049 of file qcustomplot.h.
|
inline |
Definition at line 2047 of file qcustomplot.h.
|
inline |
Definition at line 2052 of file qcustomplot.h.
|
protectedvirtual |
Reimplemented from QCPLayerable.
Definition at line 8788 of file qcustomplot.cpp.
|
protectedvirtual |
Reimplemented from QCPLayerable.
Definition at line 9161 of file qcustomplot.cpp.
|
signal |
This signal is emitted when the selection state of this axis has changed, either by user interaction or by a direct call to setSelectedParts.
|
virtual |
This function is used to decide whether a click hits a layerable object or not.
pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if onlySelectable is true and the object is not selectable, -1.0 is returned, too.
If the object is represented not by single lines but by an area like a QCPItemText or the bars of a QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99).
Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance).
The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the selectEvent/deselectEvent methods.
details is an optional output parameter. Every layerable subclass may place any information in details. This information will be passed to selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to selectEvent will carry the details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in selectTest. The result (i.e. the actually clicked part) can then be placed in details. So in the subsequent selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation.
In the case of 1D Plottables (QCPAbstractPlottable1D, like QCPGraph or QCPBars) details will be set to a QCPDataSelection, describing the closest data point to pos.
You may pass 0 as details to indicate that you are not interested in those selection details.
Reimplemented from QCPLayerable.
Definition at line 8678 of file qcustomplot.cpp.
void QCPAxis::setBasePen | ( | const QPen & | pen | ) |
Sets the pen, the axis base line is drawn with.
Definition at line 8192 of file qcustomplot.cpp.
void QCPAxis::setLabel | ( | const QString & | str | ) |
Sets the text of the axis label that will be shown below/above or next to the axis, depending on its orientation. To disable axis labels, pass an empty string as str.
Definition at line 8245 of file qcustomplot.cpp.
void QCPAxis::setLabelColor | ( | const QColor & | color | ) |
Sets the color of the axis label.
Definition at line 8236 of file qcustomplot.cpp.
void QCPAxis::setLabelFont | ( | const QFont & | font | ) |
Sets the font of the axis label.
Definition at line 8222 of file qcustomplot.cpp.
void QCPAxis::setLabelPadding | ( | int | padding | ) |
Sets the distance between the tick labels and the axis label.
Definition at line 8259 of file qcustomplot.cpp.
void QCPAxis::setLowerEnding | ( | const QCPLineEnding & | ending | ) |
Sets the style for the lower axis ending. See the documentation of QCPLineEnding for available styles.
For horizontal axes, this method refers to the left ending, for vertical axes the bottom ending. Note that this meaning does not change when the axis range is reversed with setRangeReversed.
Definition at line 8388 of file qcustomplot.cpp.
void QCPAxis::setNumberFormat | ( | const QString & | formatCode | ) |
Sets the number format for the numbers in tick labels. This formatCode is an extended version of the format code used e.g. by QString::number() and QLocale::toString(). For reference about that, see the "Argument Formats" section in the detailed description of the QString class.
formatCode is a string of one, two or three characters. The first character is identical to the normal format code used by Qt. In short, this means: 'e'/'E' scientific format, 'f' fixed format, 'g'/'G' scientific or fixed, whichever is shorter.
The second and third characters are optional and specific to QCustomPlot:
If the first char was 'e' or 'g', numbers are/might be displayed in the scientific format, e.g. "5.5e9", which is ugly in a plot. So when the second char of formatCode is set to 'b' (for "beautiful"), those exponential numbers are formatted in a more natural way, i.e. "5.5
[multiplication sign] 10 [superscript] 9". By default, the multiplication sign is a centered dot. If instead a cross should be shown (as is usual in the USA), the third char of formatCode can be set to 'c'. The inserted multiplication signs are the UTF-8 characters 215 (0xD7) for the cross and 183 (0xB7) for the dot.
Examples for formatCode:
g
normal format code behaviour. If number is small, fixed format is used, if number is large, normal scientific format is used gb
If number is small, fixed format is used, if number is large, scientific format is used with beautifully typeset decimal powers and a dot as multiplication sign ebc
All numbers are in scientific format with beautifully typeset decimal power and a cross as multiplication sign fb
illegal format code, since fixed format doesn't support (or need) beautifully typeset decimal powers. Format code will be reduced to 'f'. hello
illegal format code, since first char is not 'e', 'E', 'f', 'g' or 'G'. Current format code will not be changed. Definition at line 8014 of file qcustomplot.cpp.
void QCPAxis::setNumberPrecision | ( | int | precision | ) |
Sets the precision of the tick label numbers. See QLocale::toString(double i, char f, int prec) for details. The effect of precisions are most notably for number Formats starting with 'e', see setNumberFormat
Definition at line 8074 of file qcustomplot.cpp.
void QCPAxis::setOffset | ( | int | offset | ) |
Sets the offset the axis has to its axis rect side.
If an axis rect side has multiple axes and automatic margin calculation is enabled for that side, only the offset of the inner most axis has meaning (even if it is set to be invisible). The offset of the other, outer axes is controlled automatically, to place them at appropriate positions.
Definition at line 8295 of file qcustomplot.cpp.
void QCPAxis::setPadding | ( | int | padding | ) |
Sets the padding of the axis.
When QCPAxisRect::setAutoMargins is enabled, the padding is the additional outer most space, that is left blank.
The axis padding has no meaning if QCPAxisRect::setAutoMargins is disabled.
Definition at line 8278 of file qcustomplot.cpp.
void QCPAxis::setRange | ( | const QCPRange & | range | ) |
Sets the range of the axis.
This slot may be connected with the rangeChanged signal of another axis so this axis is always synchronized with the other axis range, when it changes.
To invert the direction of an axis, use setRangeReversed.
Definition at line 7694 of file qcustomplot.cpp.
void QCPAxis::setRange | ( | double | lower, |
double | upper | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the lower and upper bound of the axis range.
To invert the direction of an axis, use setRangeReversed.
There is also a slot to set a range, see setRange(const QCPRange &range).
Definition at line 7764 of file qcustomplot.cpp.
void QCPAxis::setRange | ( | double | position, |
double | size, | ||
Qt::AlignmentFlag | alignment | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the range of the axis.
The position coordinate indicates together with the alignment parameter, where the new range will be positioned. size defines the size of the new axis range. alignment may be Qt::AlignLeft, Qt::AlignRight or Qt::AlignCenter. This will cause the left border, right border, or center of the range to be aligned with position. Any other values of alignment will default to Qt::AlignCenter.
Definition at line 7795 of file qcustomplot.cpp.
void QCPAxis::setRangeLower | ( | double | lower | ) |
Sets the lower bound of the axis range. The upper bound is not changed.
Definition at line 7809 of file qcustomplot.cpp.
void QCPAxis::setRangeReversed | ( | bool | reversed | ) |
Sets whether the axis range (direction) is displayed reversed. Normally, the values on horizontal axes increase left to right, on vertical axes bottom to top. When reversed is set to true, the direction of increasing values is inverted.
Note that the range and data interface stays the same for reversed axes, e.g. the lower part of the setRange interface will still reference the mathematically smaller number than the upper part.
Definition at line 7858 of file qcustomplot.cpp.
void QCPAxis::setRangeUpper | ( | double | upper | ) |
Sets the upper bound of the axis range. The lower bound is not changed.
Definition at line 7831 of file qcustomplot.cpp.
void QCPAxis::setScaleRatio | ( | const QCPAxis * | otherAxis, |
double | ratio = 1.0 |
||
) |
Scales the range of this axis to have a certain scale ratio to otherAxis. The scaling will be done around the center of the current axis range.
For example, if ratio is 1, this axis is the yAxis and otherAxis is xAxis, graphs plotted with those axes will appear in a 1:1 aspect ratio, independent of the aspect ratio the axis rect has.
This is an operation that changes the range of this axis once, it doesn't fix the scale ratio indefinitely. Note that calling this function in the constructor of the QCustomPlot's parent won't have the desired effect, since the widget dimensions aren't defined yet, and a resizeEvent will follow.
Definition at line 8493 of file qcustomplot.cpp.
void QCPAxis::setScaleType | ( | QCPAxis::ScaleType | type | ) |
Sets whether the axis uses a linear scale or a logarithmic scale.
Note that this method controls the coordinate transformation. For logarithmic scales, you will likely also want to use a logarithmic tick spacing and labeling, which can be achieved by setting the axis ticker to an instance of QCPAxisTickerLog :
See the documentation of QCPAxisTickerLog about the details of logarithmic axis tick creation.
Definition at line 7674 of file qcustomplot.cpp.
void QCPAxis::setSelectableParts | ( | const QCPAxis::SelectableParts & | selectableParts | ) |
Sets whether the user can (de-)select the parts in selectable by clicking on the QCustomPlot surface. (When QCustomPlot::setInteractions contains iSelectAxes.)
However, even when selectable is set to a value not allowing the selection of a specific part, it is still possible to set the selection of this part manually, by calling setSelectedParts directly.
Definition at line 7722 of file qcustomplot.cpp.
void QCPAxis::setSelectedBasePen | ( | const QPen & | pen | ) |
Sets the pen that is used to draw the axis base line when selected.
Definition at line 8353 of file qcustomplot.cpp.
void QCPAxis::setSelectedLabelColor | ( | const QColor & | color | ) |
Sets the color that is used for the axis label when it is selected.
Definition at line 8343 of file qcustomplot.cpp.
void QCPAxis::setSelectedLabelFont | ( | const QFont & | font | ) |
Sets the font that is used for the axis label when it is selected.
Definition at line 8319 of file qcustomplot.cpp.
void QCPAxis::setSelectedParts | ( | const QCPAxis::SelectableParts & | selectedParts | ) |
Sets the selected state of the respective axis parts described by SelectablePart. When a part is selected, it uses a different pen/font.
The entire selection mechanism for axes is handled automatically when QCustomPlot::setInteractions contains iSelectAxes. You only need to call this function when you wish to change the selection state manually.
This function can change the selection state of a part, independent of the setSelectableParts setting.
emits the selectionChanged signal when selected is different from the previous selection state.
Definition at line 7746 of file qcustomplot.cpp.
void QCPAxis::setSelectedSubTickPen | ( | const QPen & | pen | ) |
Sets the pen that is used to draw the subticks when selected.
Definition at line 8373 of file qcustomplot.cpp.
void QCPAxis::setSelectedTickLabelColor | ( | const QColor & | color | ) |
Sets the color that is used for tick labels when they are selected.
Definition at line 8330 of file qcustomplot.cpp.
void QCPAxis::setSelectedTickLabelFont | ( | const QFont & | font | ) |
Sets the font that is used for tick labels when they are selected.
Definition at line 8305 of file qcustomplot.cpp.
void QCPAxis::setSelectedTickPen | ( | const QPen & | pen | ) |
Sets the pen that is used to draw the (major) ticks when selected.
Definition at line 8363 of file qcustomplot.cpp.
void QCPAxis::setSubTickLength | ( | int | inside, |
int | outside = 0 |
||
) |
Sets the length of the subticks in pixels. inside is the length the subticks will reach inside the plot and outside is the length they will reach outside the plot. If outside is greater than zero, the tick labels and axis label will increase their distance to the axis accordingly, so they won't collide with the ticks.
Definition at line 8151 of file qcustomplot.cpp.
void QCPAxis::setSubTickLengthIn | ( | int | inside | ) |
Sets the length of the inward subticks in pixels. inside is the length the subticks will reach inside the plot.
Definition at line 8163 of file qcustomplot.cpp.
void QCPAxis::setSubTickLengthOut | ( | int | outside | ) |
Sets the length of the outward subticks in pixels. outside is the length the subticks will reach outside the plot. If outside is greater than zero, the tick labels will increase their distance to the axis accordingly, so they won't collide with the ticks.
Definition at line 8178 of file qcustomplot.cpp.
void QCPAxis::setSubTickPen | ( | const QPen & | pen | ) |
Sets the pen, subtick marks will be drawn with.
Definition at line 8212 of file qcustomplot.cpp.
void QCPAxis::setSubTicks | ( | bool | show | ) |
Sets whether sub tick marks are displayed.
Sub ticks are only potentially visible if (major) ticks are also visible (see setTicks)
Definition at line 8134 of file qcustomplot.cpp.
void QCPAxis::setTicker | ( | QSharedPointer< QCPAxisTicker > | ticker | ) |
The axis ticker is responsible for generating the tick positions and tick labels. See the documentation of QCPAxisTicker for details on how to work with axis tickers.
You can change the tick positioning/labeling behaviour of this axis by setting a different QCPAxisTicker subclass using this method. If you only wish to modify the currently installed axis ticker, access it via ticker.
Since the ticker is stored in the axis as a shared pointer, multiple axes may share the same axis ticker simply by passing the same shared pointer to multiple axes.
Definition at line 7876 of file qcustomplot.cpp.
void QCPAxis::setTickLabelColor | ( | const QColor & | color | ) |
Sets the color of the tick labels.
Definition at line 7948 of file qcustomplot.cpp.
void QCPAxis::setTickLabelFont | ( | const QFont & | font | ) |
Sets the font of the tick labels.
Definition at line 7934 of file qcustomplot.cpp.
void QCPAxis::setTickLabelPadding | ( | int | padding | ) |
Sets the distance between the axis base line (including any outward ticks) and the tick labels.
Definition at line 7920 of file qcustomplot.cpp.
void QCPAxis::setTickLabelRotation | ( | double | degrees | ) |
Sets the rotation of the tick labels. If degrees is zero, the labels are drawn normally. Else, the tick labels are drawn rotated by degrees clockwise. The specified angle is bound to values from -90 to 90 degrees.
If degrees is exactly -90, 0 or 90, the tick labels are centered on the tick coordinate. For other angles, the label is drawn with an offset such that it seems to point toward or away from the tick mark.
Definition at line 7962 of file qcustomplot.cpp.
void QCPAxis::setTickLabels | ( | bool | show | ) |
Sets whether tick labels are displayed. Tick labels are the numbers drawn next to tick marks.
Definition at line 7905 of file qcustomplot.cpp.
void QCPAxis::setTickLabelSide | ( | LabelSide | side | ) |
Sets whether the tick labels (numbers) shall appear inside or outside the axis rect.
The usual and default setting is lsOutside. Very compact plots sometimes require tick labels to be inside the axis rect, to save space. If side is set to lsInside, the tick labels appear on the inside are additionally clipped to the axis rect.
Definition at line 7978 of file qcustomplot.cpp.
void QCPAxis::setTickLength | ( | int | inside, |
int | outside = 0 |
||
) |
Sets the length of the ticks in pixels. inside is the length the ticks will reach inside the plot and outside is the length they will reach outside the plot. If outside is greater than zero, the tick labels and axis label will increase their distance to the axis accordingly, so they won't collide with the ticks.
Definition at line 8091 of file qcustomplot.cpp.
void QCPAxis::setTickLengthIn | ( | int | inside | ) |
Sets the length of the inward ticks in pixels. inside is the length the ticks will reach inside the plot.
Definition at line 8103 of file qcustomplot.cpp.
void QCPAxis::setTickLengthOut | ( | int | outside | ) |
Sets the length of the outward ticks in pixels. outside is the length the ticks will reach outside the plot. If outside is greater than zero, the tick labels and axis label will increase their distance to the axis accordingly, so they won't collide with the ticks.
Definition at line 8118 of file qcustomplot.cpp.
void QCPAxis::setTickPen | ( | const QPen & | pen | ) |
Sets the pen, tick marks will be drawn with.
Definition at line 8202 of file qcustomplot.cpp.
void QCPAxis::setTicks | ( | bool | show | ) |
Sets whether tick marks are displayed.
Note that setting show to false does not imply that tick labels are invisible, too. To achieve that, see setTickLabels.
Definition at line 7893 of file qcustomplot.cpp.
void QCPAxis::setUpperEnding | ( | const QCPLineEnding & | ending | ) |
Sets the style for the upper axis ending. See the documentation of QCPLineEnding for available styles.
For horizontal axes, this method refers to the right ending, for vertical axes the top ending. Note that this meaning does not change when the axis range is reversed with setRangeReversed.
Definition at line 8403 of file qcustomplot.cpp.
|
protected |
Definition at line 9023 of file qcustomplot.cpp.
int QCPAxis::subTickLengthIn | ( | ) | const |
Definition at line 7625 of file qcustomplot.cpp.
int QCPAxis::subTickLengthOut | ( | ) | const |
Definition at line 7631 of file qcustomplot.cpp.
|
inline |
Definition at line 2038 of file qcustomplot.h.
|
inline |
Definition at line 2033 of file qcustomplot.h.
|
inline |
Returns a modifiable shared pointer to the currently installed axis ticker. The axis ticker is responsible for generating the tick positions and tick labels of this axis. You can access the QCPAxisTicker with this method and modify basic properties such as the approximate tick count (QCPAxisTicker::setTickCount).
You can gain more control over the axis ticks by setting a different QCPAxisTicker subclass, see the documentation there. A new axis ticker can be set with setTicker.
Since the ticker is stored in the axis as a shared pointer, multiple axes may share the same axis ticker simply by passing the same shared pointer to multiple axes.
Definition at line 2019 of file qcustomplot.h.
|
inline |
Definition at line 2024 of file qcustomplot.h.
|
inline |
Definition at line 2023 of file qcustomplot.h.
int QCPAxis::tickLabelPadding | ( | ) | const |
Definition at line 7581 of file qcustomplot.cpp.
double QCPAxis::tickLabelRotation | ( | ) | const |
Definition at line 7587 of file qcustomplot.cpp.
|
inline |
Definition at line 2021 of file qcustomplot.h.
QCPAxis::LabelSide QCPAxis::tickLabelSide | ( | ) | const |
Definition at line 7593 of file qcustomplot.cpp.
int QCPAxis::tickLengthIn | ( | ) | const |
Definition at line 7613 of file qcustomplot.cpp.
int QCPAxis::tickLengthOut | ( | ) | const |
Definition at line 7619 of file qcustomplot.cpp.
|
inline |
Definition at line 2037 of file qcustomplot.h.
|
inline |
Definition at line 2020 of file qcustomplot.h.
|
inline |
Definition at line 2029 of file qcustomplot.h.
|
inline |
Definition at line 2030 of file qcustomplot.h.
QCPLineEnding QCPAxis::upperEnding | ( | ) | const |
Definition at line 7655 of file qcustomplot.cpp.
|
protectedvirtual |
This event gets called when the user turns the mouse scroll wheel while the cursor is over the layerable. Whether a cursor is over the layerable is decided by a preceding call to selectTest.
The current pixel position of the cursor on the QCustomPlot widget is accessible via event->pos()
.
The event->delta()
indicates how far the mouse wheel was turned, which is usually +/- 120 for single rotation steps. However, if the mouse wheel is turned rapidly, multiple steps may accumulate to one event, making event->delta()
larger. On the other hand, if the wheel has very smooth steps or none at all, the delta may be smaller.
The default implementation does nothing.
Reimplemented from QCPLayerable.
Definition at line 8924 of file qcustomplot.cpp.
|
friend |
Definition at line 2214 of file qcustomplot.h.
|
friend |
Definition at line 2213 of file qcustomplot.h.
|
friend |
Definition at line 2212 of file qcustomplot.h.
|
protected |
Definition at line 2181 of file qcustomplot.h.
|
protected |
Definition at line 2172 of file qcustomplot.h.
|
protected |
Definition at line 2137 of file qcustomplot.h.
|
protected |
Definition at line 2136 of file qcustomplot.h.
|
protected |
Definition at line 2142 of file qcustomplot.h.
|
protected |
Definition at line 2178 of file qcustomplot.h.
|
protected |
Definition at line 2177 of file qcustomplot.h.
|
protected |
Definition at line 2179 of file qcustomplot.h.
|
protected |
Definition at line 2180 of file qcustomplot.h.
|
protected |
Definition at line 2171 of file qcustomplot.h.
|
protected |
Definition at line 2146 of file qcustomplot.h.
|
protected |
Definition at line 2148 of file qcustomplot.h.
|
protected |
Definition at line 2147 of file qcustomplot.h.
|
protected |
Definition at line 2181 of file qcustomplot.h.
|
protected |
Definition at line 2157 of file qcustomplot.h.
|
protected |
Definition at line 2156 of file qcustomplot.h.
|
protected |
Definition at line 2155 of file qcustomplot.h.
|
protected |
Definition at line 2140 of file qcustomplot.h.
|
protected |
Definition at line 2139 of file qcustomplot.h.
|
protected |
Definition at line 2166 of file qcustomplot.h.
|
protected |
Definition at line 2167 of file qcustomplot.h.
|
protected |
Definition at line 2168 of file qcustomplot.h.
|
protected |
Definition at line 2141 of file qcustomplot.h.
|
protected |
Definition at line 2142 of file qcustomplot.h.
|
protected |
Definition at line 2148 of file qcustomplot.h.
|
protected |
Definition at line 2147 of file qcustomplot.h.
|
protected |
Definition at line 2141 of file qcustomplot.h.
|
protected |
Definition at line 2164 of file qcustomplot.h.
|
protected |
Definition at line 2154 of file qcustomplot.h.
|
protected |
Definition at line 2153 of file qcustomplot.h.
|
protected |
Definition at line 2163 of file qcustomplot.h.
|
protected |
Definition at line 2164 of file qcustomplot.h.
|
protected |
Definition at line 2161 of file qcustomplot.h.
|
protected |
Definition at line 2176 of file qcustomplot.h.
|
protected |
Definition at line 2173 of file qcustomplot.h.
|
protected |
Definition at line 2154 of file qcustomplot.h.
|
protected |
Definition at line 2153 of file qcustomplot.h.
|
protected |
Definition at line 2151 of file qcustomplot.h.
|
protected |
Definition at line 2163 of file qcustomplot.h.
|
protected |
Definition at line 2160 of file qcustomplot.h.
|
protected |
Definition at line 2174 of file qcustomplot.h.
|
protected |
Definition at line 2175 of file qcustomplot.h.