ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
QCPAxis Class Reference

Manages a single axis inside a QCustomPlot. More...

#include <qcustomplot.h>

Inheritance diagram for QCPAxis:
Collaboration diagram for QCPAxis:

Public Types

enum  AxisType {
  atLeft = 0x01 , atRight = 0x02 , atTop = 0x04 , atBottom = 0x08 ,
  atLeft = 0x01 , atRight = 0x02 , atTop = 0x04 , atBottom = 0x08
}
 
enum  LabelSide { lsInside , lsOutside , lsInside , lsOutside }
 
enum  ScaleType { stLinear , stLogarithmic , stLinear , stLogarithmic }
 
enum  SelectablePart {
  spNone = 0 , spAxis = 0x001 , spTickLabels = 0x002 , spAxisLabel = 0x004 ,
  spNone = 0 , spAxis = 0x001 , spTickLabels = 0x002 , spAxisLabel = 0x004
}
 
enum  AxisType {
  atLeft = 0x01 , atRight = 0x02 , atTop = 0x04 , atBottom = 0x08 ,
  atLeft = 0x01 , atRight = 0x02 , atTop = 0x04 , atBottom = 0x08
}
 
enum  LabelType { ltNumber , ltDateTime }
 
enum  LabelSide { lsInside , lsOutside , lsInside , lsOutside }
 
enum  ScaleType { stLinear , stLogarithmic , stLinear , stLogarithmic }
 
enum  SelectablePart {
  spNone = 0 , spAxis = 0x001 , spTickLabels = 0x002 , spAxisLabel = 0x004 ,
  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 selectionChanged (const QCPAxis::SelectableParts &parts)
 
void selectableChanged (const QCPAxis::SelectableParts &parts)
 
void ticksRequest ()
 
void rangeChanged (const QCPRange &newRange)
 
void rangeChanged (const QCPRange &newRange, const QCPRange &oldRange)
 
void scaleTypeChanged (QCPAxis::ScaleType scaleType)
 
void selectionChanged (const QCPAxis::SelectableParts &parts)
 
void selectableChanged (const QCPAxis::SelectableParts &parts)
 
- Signals inherited from QCPLayerable
void layerChanged (QCPLayer *newLayer)
 
void layerChanged (QCPLayer *newLayer)
 

Public Member Functions

 QCPAxis (QCPAxisRect *parent, AxisType type)
 
virtual ~QCPAxis ()
 
AxisType axisType () const
 
QCPAxisRectaxisRect () const
 
ScaleType scaleType () const
 
const QCPRange range () const
 
bool rangeReversed () const
 
QSharedPointer< QCPAxisTickerticker () const
 
bool ticks () const
 
bool tickLabels () const
 
int tickLabelPadding () const
 
QFont tickLabelFont () const
 
QColor tickLabelColor () const
 
double tickLabelRotation () const
 
LabelSide tickLabelSide () const
 
QString numberFormat () const
 
int numberPrecision () const
 
QVector< double > tickVector () const
 
QVector< QString > tickVectorLabels () const
 
int tickLengthIn () const
 
int tickLengthOut () const
 
bool subTicks () const
 
int subTickLengthIn () const
 
int subTickLengthOut () const
 
QPen basePen () const
 
QPen tickPen () const
 
QPen subTickPen () const
 
QFont labelFont () const
 
QColor labelColor () const
 
QString label () const
 
int labelPadding () const
 
int padding () const
 
int offset () const
 
SelectableParts selectedParts () const
 
SelectableParts selectableParts () const
 
QFont selectedTickLabelFont () const
 
QFont selectedLabelFont () const
 
QColor selectedTickLabelColor () const
 
QColor selectedLabelColor () const
 
QPen selectedBasePen () const
 
QPen selectedTickPen () const
 
QPen selectedSubTickPen () const
 
QCPLineEnding lowerEnding () const
 
QCPLineEnding upperEnding () const
 
QCPGridgrid () const
 
Q_SLOT void setScaleType (QCPAxis::ScaleType type)
 
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 setRangeUpper (double upper)
 
void setRangeReversed (bool reversed)
 
void setTicker (QSharedPointer< QCPAxisTicker > ticker)
 
void setTicks (bool show)
 
void setTickLabels (bool show)
 
void setTickLabelPadding (int padding)
 
void setTickLabelFont (const QFont &font)
 
void setTickLabelColor (const QColor &color)
 
void setTickLabelRotation (double degrees)
 
void setTickLabelSide (LabelSide side)
 
void setNumberFormat (const QString &formatCode)
 
void setNumberPrecision (int precision)
 
void setTickLength (int inside, int outside=0)
 
void setTickLengthIn (int inside)
 
void setTickLengthOut (int outside)
 
void setSubTicks (bool show)
 
void setSubTickLength (int inside, int outside=0)
 
void setSubTickLengthIn (int inside)
 
void setSubTickLengthOut (int outside)
 
void setBasePen (const QPen &pen)
 
void setTickPen (const QPen &pen)
 
void setSubTickPen (const QPen &pen)
 
void setLabelFont (const QFont &font)
 
void setLabelColor (const QColor &color)
 
void setLabel (const QString &str)
 
void setLabelPadding (int padding)
 
void setPadding (int padding)
 
void setOffset (int offset)
 
void setSelectedTickLabelFont (const QFont &font)
 
void setSelectedLabelFont (const QFont &font)
 
void setSelectedTickLabelColor (const QColor &color)
 
void setSelectedLabelColor (const QColor &color)
 
void setSelectedBasePen (const QPen &pen)
 
void setSelectedTickPen (const QPen &pen)
 
void setSelectedSubTickPen (const QPen &pen)
 
Q_SLOT void setSelectableParts (const QCPAxis::SelectableParts &selectableParts)
 
Q_SLOT void setSelectedParts (const QCPAxis::SelectableParts &selectedParts)
 
void setLowerEnding (const QCPLineEnding &ending)
 
void setUpperEnding (const QCPLineEnding &ending)
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const
 
Qt::Orientation orientation () const
 
int pixelOrientation () const
 
void moveRange (double diff)
 
void scaleRange (double factor)
 
void scaleRange (double factor, double center)
 
void setScaleRatio (const QCPAxis *otherAxis, double ratio=1.0)
 
void rescale (bool onlyVisiblePlottables=false)
 
double pixelToCoord (double value) const
 
double coordToPixel (double value) const
 
SelectablePart getPartAt (const QPointF &pos) const
 
QList< QCPAbstractPlottable * > plottables () const
 
QList< QCPGraph * > graphs () const
 
QList< QCPAbstractItem * > items () const
 
 QCPAxis (QCPAxisRect *parent, AxisType type)
 
virtual ~QCPAxis ()
 
AxisType axisType () const
 
QCPAxisRectaxisRect () const
 
ScaleType scaleType () const
 
double scaleLogBase () const
 
const QCPRange range () const
 
bool rangeReversed () const
 
bool autoTicks () const
 
int autoTickCount () const
 
bool autoTickLabels () const
 
bool autoTickStep () const
 
bool autoSubTicks () const
 
bool ticks () const
 
bool tickLabels () const
 
int tickLabelPadding () const
 
LabelType tickLabelType () const
 
QFont tickLabelFont () const
 
QColor tickLabelColor () const
 
double tickLabelRotation () const
 
LabelSide tickLabelSide () const
 
QString dateTimeFormat () const
 
Qt::TimeSpec dateTimeSpec () const
 
QString numberFormat () const
 
int numberPrecision () const
 
double tickStep () const
 
QVector< double > tickVector () const
 
QVector< QString > tickVectorLabels () const
 
int tickLengthIn () const
 
int tickLengthOut () const
 
int subTickCount () const
 
int subTickLengthIn () const
 
int subTickLengthOut () const
 
QPen basePen () const
 
QPen tickPen () const
 
QPen subTickPen () const
 
QFont labelFont () const
 
QColor labelColor () const
 
QString label () const
 
int labelPadding () const
 
int padding () const
 
int offset () const
 
SelectableParts selectedParts () const
 
SelectableParts selectableParts () const
 
QFont selectedTickLabelFont () const
 
QFont selectedLabelFont () const
 
QColor selectedTickLabelColor () const
 
QColor selectedLabelColor () const
 
QPen selectedBasePen () const
 
QPen selectedTickPen () const
 
QPen selectedSubTickPen () const
 
QCPLineEnding lowerEnding () const
 
QCPLineEnding upperEnding () const
 
QCPGridgrid () const
 
Q_SLOT void setScaleType (QCPAxis::ScaleType type)
 
void setScaleLogBase (double base)
 
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 setRangeUpper (double upper)
 
void setRangeReversed (bool reversed)
 
void setAutoTicks (bool on)
 
void setAutoTickCount (int approximateCount)
 
void setAutoTickLabels (bool on)
 
void setAutoTickStep (bool on)
 
void setAutoSubTicks (bool on)
 
void setTicks (bool show)
 
void setTickLabels (bool show)
 
void setTickLabelPadding (int padding)
 
void setTickLabelType (LabelType type)
 
void setTickLabelFont (const QFont &font)
 
void setTickLabelColor (const QColor &color)
 
void setTickLabelRotation (double degrees)
 
void setTickLabelSide (LabelSide side)
 
void setDateTimeFormat (const QString &format)
 
void setDateTimeSpec (const Qt::TimeSpec &timeSpec)
 
void setNumberFormat (const QString &formatCode)
 
void setNumberPrecision (int precision)
 
void setTickStep (double step)
 
void setTickVector (const QVector< double > &vec)
 
void setTickVectorLabels (const QVector< QString > &vec)
 
void setTickLength (int inside, int outside=0)
 
void setTickLengthIn (int inside)
 
void setTickLengthOut (int outside)
 
void setSubTickCount (int count)
 
void setSubTickLength (int inside, int outside=0)
 
void setSubTickLengthIn (int inside)
 
void setSubTickLengthOut (int outside)
 
void setBasePen (const QPen &pen)
 
void setTickPen (const QPen &pen)
 
void setSubTickPen (const QPen &pen)
 
void setLabelFont (const QFont &font)
 
void setLabelColor (const QColor &color)
 
void setLabel (const QString &str)
 
void setLabelPadding (int padding)
 
void setPadding (int padding)
 
void setOffset (int offset)
 
void setSelectedTickLabelFont (const QFont &font)
 
void setSelectedLabelFont (const QFont &font)
 
void setSelectedTickLabelColor (const QColor &color)
 
void setSelectedLabelColor (const QColor &color)
 
void setSelectedBasePen (const QPen &pen)
 
void setSelectedTickPen (const QPen &pen)
 
void setSelectedSubTickPen (const QPen &pen)
 
Q_SLOT void setSelectableParts (const QCPAxis::SelectableParts &selectableParts)
 
Q_SLOT void setSelectedParts (const QCPAxis::SelectableParts &selectedParts)
 
void setLowerEnding (const QCPLineEnding &ending)
 
void setUpperEnding (const QCPLineEnding &ending)
 
virtual double selectTest (const QPointF &pos, bool onlySelectable, QVariant *details=0) const
 
Qt::Orientation orientation () const
 
void moveRange (double diff)
 
void scaleRange (double factor, double center)
 
void setScaleRatio (const QCPAxis *otherAxis, double ratio=1.0)
 
void rescale (bool onlyVisiblePlottables=false)
 
double pixelToCoord (double value) const
 
double coordToPixel (double value) const
 
SelectablePart getPartAt (const QPointF &pos) const
 
QList< QCPAbstractPlottable * > plottables () const
 
QList< QCPGraph * > graphs () const
 
QList< QCPAbstractItem * > items () const
 
- Public Member Functions inherited from QCPLayerable
 QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0)
 
virtual ~QCPLayerable ()
 
bool visible () const
 
QCustomPlotparentPlot () const
 
QCPLayerableparentLayerable () const
 
QCPLayerlayer () const
 
bool antialiased () const
 
void setVisible (bool on)
 
Q_SLOT bool setLayer (QCPLayer *layer)
 
bool setLayer (const QString &layerName)
 
void setAntialiased (bool enabled)
 
bool realVisibility () const
 
 QCPLayerable (QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0)
 
 ~QCPLayerable ()
 
bool visible () const
 
QCustomPlotparentPlot () const
 
QCPLayerableparentLayerable () const
 
QCPLayerlayer () const
 
bool antialiased () const
 
void setVisible (bool on)
 
Q_SLOT bool setLayer (QCPLayer *layer)
 
bool setLayer (const QString &layerName)
 
void setAntialiased (bool enabled)
 
bool realVisibility () const
 

Static Public Member Functions

static AxisType marginSideToAxisType (QCP::MarginSide side)
 
static Qt::Orientation orientation (AxisType type)
 
static AxisType opposite (AxisType type)
 
static AxisType marginSideToAxisType (QCP::MarginSide side)
 
static Qt::Orientation orientation (AxisType type)
 
static AxisType opposite (AxisType type)
 

Protected Member Functions

virtual int calculateMargin ()
 
virtual void applyDefaultAntialiasingHint (QCPPainter *painter) const
 
virtual void draw (QCPPainter *painter)
 
virtual QCP::Interaction selectionCategory () const
 
virtual void selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
 
virtual void deselectEvent (bool *selectionStateChanged)
 
virtual void mousePressEvent (QMouseEvent *event, const QVariant &details)
 
virtual void mouseMoveEvent (QMouseEvent *event, const QPointF &startPos)
 
virtual void mouseReleaseEvent (QMouseEvent *event, const QPointF &startPos)
 
virtual void wheelEvent (QWheelEvent *event)
 
void setupTickVectors ()
 
QPen getBasePen () const
 
QPen getTickPen () const
 
QPen getSubTickPen () const
 
QFont getTickLabelFont () const
 
QFont getLabelFont () const
 
QColor getTickLabelColor () const
 
QColor getLabelColor () const
 
virtual void setupTickVectors ()
 
virtual void generateAutoTicks ()
 
virtual int calculateAutoSubTickCount (double tickStep) const
 
virtual int calculateMargin ()
 
virtual void applyDefaultAntialiasingHint (QCPPainter *painter) const
 
virtual void draw (QCPPainter *painter)
 
virtual QCP::Interaction selectionCategory () const
 
virtual void selectEvent (QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged)
 
virtual void deselectEvent (bool *selectionStateChanged)
 
void visibleTickBounds (int &lowIndex, int &highIndex) const
 
double baseLog (double value) const
 
double basePow (double value) const
 
QPen getBasePen () const
 
QPen getTickPen () const
 
QPen getSubTickPen () const
 
QFont getTickLabelFont () const
 
QFont getLabelFont () const
 
QColor getTickLabelColor () const
 
QColor getLabelColor () const
 
- Protected Member Functions inherited from QCPLayerable
virtual void parentPlotInitialized (QCustomPlot *parentPlot)
 
virtual QRect clipRect () const
 
virtual void mouseDoubleClickEvent (QMouseEvent *event, const QVariant &details)
 
void initializeParentPlot (QCustomPlot *parentPlot)
 
void setParentLayerable (QCPLayerable *parentLayerable)
 
bool moveToLayer (QCPLayer *layer, bool prepend)
 
void applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const
 
virtual void parentPlotInitialized (QCustomPlot *parentPlot)
 
virtual QRect clipRect () const
 
void initializeParentPlot (QCustomPlot *parentPlot)
 
void setParentLayerable (QCPLayerable *parentLayerable)
 
bool moveToLayer (QCPLayer *layer, bool prepend)
 
void applyAntialiasingHint (QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const
 

Protected Attributes

AxisType mAxisType
 
QCPAxisRectmAxisRect
 
int mPadding
 
Qt::Orientation mOrientation
 
SelectableParts mSelectableParts
 
SelectableParts mSelectedParts
 
QPen mBasePen
 
QPen mSelectedBasePen
 
QString mLabel
 
QFont mLabelFont
 
QFont mSelectedLabelFont
 
QColor mLabelColor
 
QColor mSelectedLabelColor
 
bool mTickLabels
 
QFont mTickLabelFont
 
QFont mSelectedTickLabelFont
 
QColor mTickLabelColor
 
QColor mSelectedTickLabelColor
 
int mNumberPrecision
 
QLatin1Char mNumberFormatChar
 
bool mNumberBeautifulPowers
 
bool mTicks
 
bool mSubTicks
 
QPen mTickPen
 
QPen mSelectedTickPen
 
QPen mSubTickPen
 
QPen mSelectedSubTickPen
 
QCPRange mRange
 
bool mRangeReversed
 
ScaleType mScaleType
 
QCPGridmGrid
 
QCPAxisPainterPrivate * mAxisPainter
 
QSharedPointer< QCPAxisTickermTicker
 
QVector< double > mTickVector
 
QVector< QString > mTickVectorLabels
 
QVector< double > mSubTickVector
 
bool mCachedMarginValid
 
int mCachedMargin
 
bool mDragging
 
QCPRange mDragStartRange
 
QCP::AntialiasedElements mAADragBackup
 
QCP::AntialiasedElements mNotAADragBackup
 
bool mAutoTickLabels
 
LabelType mTickLabelType
 
QString mDateTimeFormat
 
Qt::TimeSpec mDateTimeSpec
 
double mTickStep
 
int mSubTickCount
 
int mAutoTickCount
 
bool mAutoTicks
 
bool mAutoTickStep
 
bool mAutoSubTicks
 
double mScaleLogBase
 
double mScaleLogBaseLogInv
 
int mLowestVisibleTick
 
int mHighestVisibleTick
 
- Protected Attributes inherited from QCPLayerable
bool mVisible
 
QCustomPlotmParentPlot
 
QPointer< QCPLayerablemParentLayerable
 
QCPLayermLayer
 
bool mAntialiased
 

Detailed Description

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.

Naming convention of axis parts


Overview of the spacings and paddings that define the geometry of an axis. The dashed gray line on the left represents the QCustomPlot widget border.

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.

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.

Naming convention of axis parts


Overview of the spacings and paddings that define the geometry of an axis. The dashed gray line on the left represents the QCustomPlot widget border.

Definition at line 2254 of file qcustomplot.h.

Member Enumeration Documentation

◆ AxisType [1/2]

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.

Enumerator
atLeft 

0x01 Axis is vertical and on the left side of the axis rect

atRight 

0x02 Axis is vertical and on the right side of the axis rect

atTop 

0x04 Axis is horizontal and on the top side of the axis rect

atBottom 

0x08 Axis is horizontal and on the bottom side of the axis rect

atLeft 

0x01 Axis is vertical and on the left side of the axis rect

atRight 

0x02 Axis is vertical and on the right side of the axis rect

atTop 

0x04 Axis is horizontal and on the top side of the axis rect

atBottom 

0x08 Axis is horizontal and on the bottom side of the axis rect

Definition at line 2324 of file qcustomplot.h.

◆ AxisType [2/2]

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.

Enumerator
atLeft 

0x01 Axis is vertical and on the left side of the axis rect

atRight 

0x02 Axis is vertical and on the right side of the axis rect

atTop 

0x04 Axis is horizontal and on the top side of the axis rect

atBottom 

0x08 Axis is horizontal and on the bottom side of the axis rect

atLeft 

0x01 Axis is vertical and on the left side of the axis rect

atRight 

0x02 Axis is vertical and on the right side of the axis rect

atTop 

0x04 Axis is horizontal and on the top side of the axis rect

atBottom 

0x08 Axis is horizontal and on the bottom side of the axis rect

Definition at line 1282 of file qcustomplot.h.

◆ LabelSide [1/2]

Defines on which side of the axis the tick labels (numbers) shall appear.

See also
setTickLabelSide
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.

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 2345 of file qcustomplot.h.

◆ LabelSide [2/2]

Defines on which side of the axis the tick labels (numbers) shall appear.

See also
setTickLabelSide
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.

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 1319 of file qcustomplot.h.

◆ LabelType

When automatic tick label generation is enabled (setAutoTickLabels), defines how the coordinate of the tick is interpreted, i.e. translated into a string.

See also
setTickLabelType
Enumerator
ltNumber 

Tick coordinate is regarded as normal number and will be displayed as such. (see setNumberFormat)

ltDateTime 

Tick coordinate is regarded as a date/time (seconds since 1970-01-01T00:00:00 UTC) and will be displayed and formatted as such. (for details, see setDateTimeFormat)

Definition at line 1304 of file qcustomplot.h.

◆ ScaleType [1/2]

Defines the scale of an axis.

See also
setScaleType
Enumerator
stLinear 

Linear scaling.

stLogarithmic 

Logarithmic scaling with correspondingly transformed axis coordinates (possibly also setTicker to a QCPAxisTickerLog instance).

Logarithmic scaling with correspondingly transformed plots and (major) tick marks at every base power (see setScaleLogBase).

stLinear 

Linear scaling.

stLogarithmic 

Logarithmic scaling with correspondingly transformed axis coordinates (possibly also setTicker to a QCPAxisTickerLog instance).

Logarithmic scaling with correspondingly transformed plots and (major) tick marks at every base power (see setScaleLogBase).

Definition at line 2356 of file qcustomplot.h.

◆ ScaleType [2/2]

Defines the scale of an axis.

See also
setScaleType
Enumerator
stLinear 

Linear scaling.

stLogarithmic 

Logarithmic scaling with correspondingly transformed axis coordinates (possibly also setTicker to a QCPAxisTickerLog instance).

Logarithmic scaling with correspondingly transformed plots and (major) tick marks at every base power (see setScaleLogBase).

stLinear 

Linear scaling.

stLogarithmic 

Logarithmic scaling with correspondingly transformed axis coordinates (possibly also setTicker to a QCPAxisTickerLog instance).

Logarithmic scaling with correspondingly transformed plots and (major) tick marks at every base power (see setScaleLogBase).

Definition at line 1330 of file qcustomplot.h.

◆ SelectablePart [1/2]

Defines the selectable parts of an axis.

See also
setSelectableParts, setSelectedParts
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.

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 2368 of file qcustomplot.h.

◆ SelectablePart [2/2]

Defines the selectable parts of an axis.

See also
setSelectableParts, setSelectedParts
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.

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 1342 of file qcustomplot.h.

Constructor & Destructor Documentation

◆ QCPAxis() [1/2]

QCPAxis::QCPAxis ( QCPAxisRect parent,
AxisType  type 
)
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 7698 of file qcustomplot.cpp.

References atBottom, atLeft, atRight, atTop, mGrid, QCPLayerable::mParentPlot, QCPLayerable::setAntialiased(), setLabelPadding(), QCPLayerable::setLayer(), setTickLabelPadding(), QCPLayerable::setVisible(), and type.

◆ ~QCPAxis() [1/2]

QCPAxis::~QCPAxis ( )
virtual

Definition at line 7767 of file qcustomplot.cpp.

References mAxisPainter, and mGrid.

◆ QCPAxis() [2/2]

QCPAxis::QCPAxis ( QCPAxisRect parent,
AxisType  type 
)
explicit

◆ ~QCPAxis() [2/2]

virtual QCPAxis::~QCPAxis ( )
virtual

Member Function Documentation

◆ applyDefaultAntialiasingHint() [1/2]

void QCPAxis::applyDefaultAntialiasingHint ( QCPPainter painter) const
protectedvirtual

◆ applyDefaultAntialiasingHint() [2/2]

virtual void QCPAxis::applyDefaultAntialiasingHint ( QCPPainter painter) const
protectedvirtual

Implements QCPLayerable.

◆ autoSubTicks()

bool QCPAxis::autoSubTicks ( ) const
inline

Definition at line 1369 of file qcustomplot.h.

◆ autoTickCount()

int QCPAxis::autoTickCount ( ) const
inline

Definition at line 1366 of file qcustomplot.h.

◆ autoTickLabels()

bool QCPAxis::autoTickLabels ( ) const
inline

Definition at line 1367 of file qcustomplot.h.

◆ autoTicks()

bool QCPAxis::autoTicks ( ) const
inline

Definition at line 1365 of file qcustomplot.h.

◆ autoTickStep()

bool QCPAxis::autoTickStep ( ) const
inline

Definition at line 1368 of file qcustomplot.h.

◆ axisRect() [1/2]

◆ axisRect() [2/2]

QCPAxisRect* QCPAxis::axisRect ( ) const
inline

Definition at line 1360 of file qcustomplot.h.

◆ axisType() [1/2]

AxisType QCPAxis::axisType ( ) const
inline

◆ axisType() [2/2]

AxisType QCPAxis::axisType ( ) const
inline

Definition at line 1359 of file qcustomplot.h.

◆ baseLog()

double QCPAxis::baseLog ( double  value) const
protected

Definition at line 5917 of file qcustomplot.cpp.

References mScaleLogBaseLogInv.

Referenced by generateAutoTicks().

◆ basePen() [1/2]

QPen QCPAxis::basePen ( ) const
inline

Definition at line 2408 of file qcustomplot.h.

◆ basePen() [2/2]

QPen QCPAxis::basePen ( ) const
inline

Definition at line 1390 of file qcustomplot.h.

◆ basePow()

double QCPAxis::basePow ( double  value) const
protected

Definition at line 5928 of file qcustomplot.cpp.

References mScaleLogBase.

Referenced by generateAutoTicks().

◆ calculateAutoSubTickCount()

int QCPAxis::calculateAutoSubTickCount ( double  tickStep) const
protectedvirtual

Definition at line 5673 of file qcustomplot.cpp.

References mSubTickCount, result, and tickStep().

Referenced by generateAutoTicks().

◆ calculateMargin() [1/2]

◆ calculateMargin() [2/2]

virtual int QCPAxis::calculateMargin ( )
protectedvirtual

◆ coordToPixel() [1/2]

double QCPAxis::coordToPixel ( double  value) const

Transforms value, in coordinates of the axis, to pixel coordinates of the QCustomPlot widget.

Definition at line 8735 of file qcustomplot.cpp.

References QCPAxisRect::bottom(), QCPAxisRect::height(), QCPAxisRect::left(), QCPRange::lower, mAxisRect, mRange, mRangeReversed, mScaleType, orientation(), QCPAxisRect::right(), QCPRange::size(), stLinear, QCPAxisRect::top(), QCPRange::upper, and QCPAxisRect::width().

Referenced by calculateMargin(), QCPFinancial::candlestickSelectTest(), QCPAbstractPlottable::coordsToPixels(), QCPBars::dataPixelPosition(), QCPGraph::dataToImpulseLines(), QCPGraph::dataToLines(), QCPGraph::dataToStepCenterLines(), QCPGraph::dataToStepLeftLines(), QCPGraph::dataToStepRightLines(), QCPHiddenArea::draw(), QCPArrow::draw(), draw(), QCPFinancial::drawCandlestickPlot(), QCPGraph::drawError(), QCPGrid::drawGridLines(), QCPFinancial::drawOhlcPlot(), QCPGraph::drawScatterPlot(), QCPGrid::drawSubGridLines(), QCPBars::getBarPolygon(), QCPBars::getBarRect(), QCPCurve::getCurveData(), QCPCurve::getCurveLines(), QCPErrorBars::getErrorBarLines(), QCPGraph::getFillBasePoint(), QCPGraph::getImpulsePlotData(), QCPGraph::getLinePlotData(), QCPGraph::getOptimizedLineData(), QCPGraph::getOptimizedScatterData(), QCPSelectionDecoratorBracket::getPixelCoordinates(), QCPGraph::getPreparedData(), QCPGraph::getScatters(), QCPCurve::getScatters(), QCPGraph::getStepCenterPlotData(), QCPGraph::getStepLeftPlotData(), QCPGraph::getStepRightPlotData(), QCPGraph::lowerFillBasePoint(), QCPFinancial::ohlcSelectTest(), QCPFinancial::selectionHitBox(), and QCPGraph::upperFillBasePoint().

◆ coordToPixel() [2/2]

double QCPAxis::coordToPixel ( double  value) const

◆ dateTimeFormat()

QString QCPAxis::dateTimeFormat ( ) const
inline

Definition at line 1378 of file qcustomplot.h.

◆ dateTimeSpec()

Qt::TimeSpec QCPAxis::dateTimeSpec ( ) const
inline

Definition at line 1379 of file qcustomplot.h.

◆ deselectEvent() [1/2]

void QCPAxis::deselectEvent ( bool *  selectionStateChanged)
protectedvirtual

Reimplemented from QCPLayerable.

Definition at line 8972 of file qcustomplot.cpp.

References mSelectableParts, mSelectedParts, and setSelectedParts().

◆ deselectEvent() [2/2]

virtual void QCPAxis::deselectEvent ( bool *  selectionStateChanged)
protectedvirtual

Reimplemented from QCPLayerable.

◆ draw() [1/2]

◆ draw() [2/2]

virtual void QCPAxis::draw ( QCPPainter painter)
protectedvirtual

Implements QCPLayerable.

◆ generateAutoTicks()

◆ getBasePen() [1/2]

QPen QCPAxis::getBasePen ( ) const
protected

Definition at line 9220 of file qcustomplot.cpp.

References mBasePen, mSelectedBasePen, mSelectedParts, and spAxis.

Referenced by draw().

◆ getBasePen() [2/2]

QPen QCPAxis::getBasePen ( ) const
protected

◆ getLabelColor() [1/2]

QColor QCPAxis::getLabelColor ( ) const
protected

Definition at line 9277 of file qcustomplot.cpp.

References mLabelColor, mSelectedLabelColor, mSelectedParts, and spAxisLabel.

Referenced by draw().

◆ getLabelColor() [2/2]

QColor QCPAxis::getLabelColor ( ) const
protected

◆ getLabelFont() [1/2]

QFont QCPAxis::getLabelFont ( ) const
protected

Definition at line 9257 of file qcustomplot.cpp.

References mLabelFont, mSelectedLabelFont, mSelectedParts, and spAxisLabel.

Referenced by calculateMargin(), and draw().

◆ getLabelFont() [2/2]

QFont QCPAxis::getLabelFont ( ) const
protected

◆ getPartAt() [1/2]

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.

See also
setSelectedParts, setSelectableParts, QCustomPlot::setInteractions

Definition at line 8823 of file qcustomplot.cpp.

References mAxisPainter, QCPLayerable::mVisible, spAxis, spAxisLabel, spNone, and spTickLabels.

Referenced by selectTest().

◆ getPartAt() [2/2]

SelectablePart QCPAxis::getPartAt ( const QPointF &  pos) const

◆ getSubTickPen() [1/2]

QPen QCPAxis::getSubTickPen ( ) const
protected

Definition at line 9238 of file qcustomplot.cpp.

References mSelectedParts, mSelectedSubTickPen, mSubTickPen, and spAxis.

Referenced by draw().

◆ getSubTickPen() [2/2]

QPen QCPAxis::getSubTickPen ( ) const
protected

◆ getTickLabelColor() [1/2]

QColor QCPAxis::getTickLabelColor ( ) const
protected

Definition at line 9267 of file qcustomplot.cpp.

References mSelectedParts, mSelectedTickLabelColor, mTickLabelColor, and spTickLabels.

Referenced by draw().

◆ getTickLabelColor() [2/2]

QColor QCPAxis::getTickLabelColor ( ) const
protected

◆ getTickLabelFont() [1/2]

QFont QCPAxis::getTickLabelFont ( ) const
protected

Definition at line 9247 of file qcustomplot.cpp.

References mSelectedParts, mSelectedTickLabelFont, mTickLabelFont, and spTickLabels.

Referenced by draw().

◆ getTickLabelFont() [2/2]

QFont QCPAxis::getTickLabelFont ( ) const
protected

◆ getTickPen() [1/2]

QPen QCPAxis::getTickPen ( ) const
protected

Definition at line 9229 of file qcustomplot.cpp.

References mSelectedParts, mSelectedTickPen, mTickPen, and spAxis.

Referenced by draw().

◆ getTickPen() [2/2]

QPen QCPAxis::getTickPen ( ) const
protected

◆ graphs() [1/2]

QList< QCPGraph * > QCPAxis::graphs ( ) const

Returns a list of all the graphs that have this axis as key or value axis.

See also
plottables, items

Definition at line 8873 of file qcustomplot.cpp.

References QCustomPlot::mGraphs, QCPLayerable::mParentPlot, and result.

◆ graphs() [2/2]

QList<QCPGraph *> QCPAxis::graphs ( ) const

◆ grid() [1/2]

QCPGrid * QCPAxis::grid ( ) const
inline

Returns the QCPGrid instance belonging to this axis. Access it to set details about the way the grid is displayed.

Definition at line 2428 of file qcustomplot.h.

Referenced by QCPAxisRect::QCPAxisRect(), and QCustomPlot::QCustomPlot().

◆ grid() [2/2]

QCPGrid* QCPAxis::grid ( ) const
inline

Definition at line 1410 of file qcustomplot.h.

◆ items() [1/2]

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.

See also
plottables, graphs

Definition at line 8892 of file qcustomplot.cpp.

References QCustomPlot::mItems, QCPLayerable::mParentPlot, and result.

◆ items() [2/2]

QList<QCPAbstractItem *> QCPAxis::items ( ) const

◆ label() [1/2]

QString QCPAxis::label ( ) const
inline

Definition at line 2413 of file qcustomplot.h.

◆ label() [2/2]

QString QCPAxis::label ( ) const
inline

Definition at line 1395 of file qcustomplot.h.

◆ labelColor() [1/2]

QColor QCPAxis::labelColor ( ) const
inline

Definition at line 2412 of file qcustomplot.h.

◆ labelColor() [2/2]

QColor QCPAxis::labelColor ( ) const
inline

Definition at line 1394 of file qcustomplot.h.

◆ labelFont() [1/2]

QFont QCPAxis::labelFont ( ) const
inline

Definition at line 2411 of file qcustomplot.h.

◆ labelFont() [2/2]

QFont QCPAxis::labelFont ( ) const
inline

Definition at line 1393 of file qcustomplot.h.

◆ labelPadding() [1/2]

int QCPAxis::labelPadding ( ) const

Definition at line 7810 of file qcustomplot.cpp.

References mAxisPainter.

◆ labelPadding() [2/2]

int QCPAxis::labelPadding ( ) const

◆ lowerEnding() [1/2]

QCPLineEnding QCPAxis::lowerEnding ( ) const

Definition at line 7816 of file qcustomplot.cpp.

References mAxisPainter.

◆ lowerEnding() [2/2]

QCPLineEnding QCPAxis::lowerEnding ( ) const

◆ marginSideToAxisType() [1/2]

QCPAxis::AxisType QCPAxis::marginSideToAxisType ( QCP::MarginSide  side)
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 8914 of file qcustomplot.cpp.

References atBottom, atLeft, atRight, atTop, QCP::msBottom, QCP::msLeft, QCP::msRight, and QCP::msTop.

Referenced by QCPAxisRect::calculateAutoMargin().

◆ marginSideToAxisType() [2/2]

static AxisType QCPAxis::marginSideToAxisType ( QCP::MarginSide  side)
static

◆ mouseMoveEvent()

void QCPAxis::mouseMoveEvent ( QMouseEvent *  event,
const QPointF &  startPos 
)
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.

See also
mousePressEvent, mouseReleaseEvent, mouseDoubleClickEvent, wheelEvent

Reimplemented from QCPLayerable.

Definition at line 9031 of file qcustomplot.cpp.

References QCP::aeAll, QCPRange::lower, mDragging, mDragStartRange, QCPLayerable::mParentPlot, mScaleType, QCustomPlot::noAntialiasingOnDrag(), orientation(), pixelToCoord(), QCustomPlot::replot(), QCustomPlot::rpQueuedReplot, QCustomPlot::setNotAntialiasedElements(), setRange(), stLinear, stLogarithmic, and QCPRange::upper.

◆ mousePressEvent()

void QCPAxis::mousePressEvent ( QMouseEvent *  event,
const QVariant &  details 
)
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().

See also
mouseMoveEvent, mouseReleaseEvent, mouseDoubleClickEvent, wheelEvent

Reimplemented from QCPLayerable.

Definition at line 8996 of file qcustomplot.cpp.

References QCustomPlot::antialiasedElements(), event, QCustomPlot::interactions(), QCP::iRangeDrag, mAADragBackup, mAxisRect, mDragging, mDragStartRange, mNotAADragBackup, QCPLayerable::mParentPlot, mRange, QCustomPlot::noAntialiasingOnDrag(), QCustomPlot::notAntialiasedElements(), orientation(), QCPAxisRect::rangeDrag(), and QCPAxisRect::rangeDragAxes().

◆ mouseReleaseEvent()

void QCPAxis::mouseReleaseEvent ( QMouseEvent *  event,
const QPointF &  startPos 
)
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.

See also
mousePressEvent, mouseMoveEvent, mouseDoubleClickEvent, wheelEvent

Reimplemented from QCPLayerable.

Definition at line 9069 of file qcustomplot.cpp.

References event, mAADragBackup, mDragging, mNotAADragBackup, QCPLayerable::mParentPlot, QCustomPlot::noAntialiasingOnDrag(), QCustomPlot::setAntialiasedElements(), and QCustomPlot::setNotAntialiasedElements().

◆ moveRange() [1/2]

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 8522 of file qcustomplot.cpp.

References QCPRange::lower, mRange, mScaleType, rangeChanged(), stLinear, and QCPRange::upper.

◆ moveRange() [2/2]

void QCPAxis::moveRange ( double  diff)

◆ numberFormat() [1/2]

QString QCPAxis::numberFormat ( ) const

◆ numberFormat() [2/2]

QString QCPAxis::numberFormat ( ) const

◆ numberPrecision() [1/2]

int QCPAxis::numberPrecision ( ) const
inline

Definition at line 2400 of file qcustomplot.h.

Referenced by QCPAxisRect::setupFullAxesBox().

◆ numberPrecision() [2/2]

int QCPAxis::numberPrecision ( ) const
inline

Definition at line 1381 of file qcustomplot.h.

◆ offset() [1/2]

int QCPAxis::offset ( ) const

Definition at line 7813 of file qcustomplot.cpp.

References mAxisPainter.

Referenced by QCPAxisRect::removeAxis(), and setOffset().

◆ offset() [2/2]

int QCPAxis::offset ( ) const

◆ opposite() [1/2]

QCPAxis::AxisType QCPAxis::opposite ( QCPAxis::AxisType  type)
static

Returns the axis type that describes the opposite axis of an axis with the specified type.

Definition at line 8935 of file qcustomplot.cpp.

References atBottom, atLeft, atRight, atTop, and type.

◆ opposite() [2/2]

static AxisType QCPAxis::opposite ( AxisType  type)
static

◆ orientation() [1/4]

Qt::Orientation QCPAxis::orientation ( ) const
inline

Returns the orientation of this axis. The axis orientation (horizontal or vertical) is deduced from the axis type (left, top, right or bottom).

See also
orientation(AxisType type), pixelOrientation

Returns the orientation of this axis. The axis orientation (horizontal or vertical) is deduced from the axis type (left, top, right or bottom).

See also
orientation(AxisType type)

Definition at line 2483 of file qcustomplot.h.

Referenced by QCPFinancial::candlestickSelectTest(), QCPAbstractPlottable::coordsToPixels(), coordToPixel(), QCPBars::dataPixelPosition(), QCPGraph::dataToImpulseLines(), QCPGraph::dataToLines(), QCPGraph::dataToStepCenterLines(), QCPGraph::dataToStepLeftLines(), QCPGraph::dataToStepRightLines(), QCPColorMap::draw(), QCPFinancial::drawCandlestickPlot(), QCPGraph::drawError(), QCPGrid::drawGridLines(), QCPFinancial::drawOhlcPlot(), QCPGraph::drawScatterPlot(), QCPGrid::drawSubGridLines(), QCPBars::getBarPolygon(), QCPBars::getBarRect(), QCPGraph::getChannelFillPolygon(), QCPCurve::getCurveData(), QCPErrorBars::getErrorBarLines(), QCPGraph::getFillBasePoint(), QCPGraph::getImpulsePlotData(), QCPGraph::getLinePlotData(), QCPSelectionDecoratorBracket::getPixelCoordinates(), QCPGraph::getPreparedData(), QCPGraph::getScatters(), QCPCurve::getScatters(), QCPGraph::getStepCenterPlotData(), QCPGraph::getStepLeftPlotData(), QCPGraph::getStepRightPlotData(), QCPGraph::lowerFillBasePoint(), mouseMoveEvent(), mousePressEvent(), QCPFinancial::ohlcSelectTest(), QCPAbstractPlottable::pixelsToCoords(), pixelToCoord(), QCPAbstractPlottable::QCPAbstractPlottable(), QCPSelectionRect::range(), QCPColorScale::rangeDrag(), QCPColorScale::rangeZoom(), QCPFinancial::selectionHitBox(), QCPColorScale::setRangeDrag(), QCPAxisRect::setRangeDragAxes(), QCPColorScale::setRangeZoom(), QCPAxisRect::setRangeZoomAxes(), setScaleRatio(), QCPColorMap::updateLegendIcon(), QCPColorMap::updateMapImage(), QCPGraph::upperFillBasePoint(), wheelEvent(), and QCPAxisRect::zoom().

◆ orientation() [2/4]

Qt::Orientation QCPAxis::orientation ( ) const
inline

Definition at line 1476 of file qcustomplot.h.

◆ orientation() [3/4]

static Qt::Orientation QCPAxis::orientation ( AxisType  type)
inlinestatic

Returns the orientation of the specified axis type

See also
orientation(), pixelOrientation

Returns the orientation of the specified axis type

See also
orientation()

Definition at line 2500 of file qcustomplot.h.

References type.

◆ orientation() [4/4]

static Qt::Orientation QCPAxis::orientation ( AxisType  type)
inlinestatic

Definition at line 1489 of file qcustomplot.h.

References type.

◆ padding() [1/2]

int QCPAxis::padding ( ) const
inline

Definition at line 2415 of file qcustomplot.h.

Referenced by setLabelPadding(), setPadding(), and setTickLabelPadding().

◆ padding() [2/2]

int QCPAxis::padding ( ) const
inline

Definition at line 1397 of file qcustomplot.h.

◆ pixelOrientation()

int QCPAxis::pixelOrientation ( ) const
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:

double newKey =
keyAxis->pixelToCoord(keyAxis->coordToPixel(oldKey)+10*keyAxis->pixelOrientation());

newKey will then contain a key that is ten pixels towards higher keys, starting from oldKey.

Definition at line 2484 of file qcustomplot.h.

Referenced by QCPBars::getBarRect(), QCPCurve::getCurveLines(), QCPErrorBars::getErrorBarLines(), QCPGraph::getOptimizedLineData(), QCPGraph::getOptimizedScatterData(), QCPCurve::getScatters(), and QCPBarsGroup::keyPixelOffset().

◆ pixelToCoord() [1/2]

◆ pixelToCoord() [2/2]

double QCPAxis::pixelToCoord ( double  value) const

◆ plottables() [1/2]

QList< QCPAbstractPlottable * > QCPAxis::plottables ( ) const

Returns a list of all the plottables that have this axis as key or value axis.

If you are only interested in plottables of type QCPGraph, see graphs.

See also
graphs, items

Definition at line 8856 of file qcustomplot.cpp.

References QCPLayerable::mParentPlot, QCustomPlot::mPlottables, and result.

Referenced by rescale().

◆ plottables() [2/2]

QList<QCPAbstractPlottable *> QCPAxis::plottables ( ) const

◆ range() [1/2]

◆ range() [2/2]

const QCPRange QCPAxis::range ( ) const
inline

Definition at line 1363 of file qcustomplot.h.

◆ rangeChanged [1/4]

void QCPAxis::rangeChanged ( const QCPRange newRange)
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:

customPlot->xAxis->setRange(newRange.bounded(0, 10))

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. For example, the following slot would limit the x axis to only positive ranges:

if (newRange.lower < 0) plot->xAxis->setRange(0,
newRange.size());

Referenced by moveRange(), scaleRange(), setRange(), setRangeLower(), and setRangeUpper().

◆ rangeChanged [2/4]

void QCPAxis::rangeChanged ( const QCPRange newRange)
signal

◆ rangeChanged [3/4]

void QCPAxis::rangeChanged ( const QCPRange newRange,
const QCPRange oldRange 
)
signal

Additionally to the new range, this signal also provides the previous range held by the axis as oldRange.

◆ rangeChanged [4/4]

void QCPAxis::rangeChanged ( const QCPRange newRange,
const QCPRange oldRange 
)
signal

◆ rangeReversed() [1/2]

◆ rangeReversed() [2/2]

bool QCPAxis::rangeReversed ( ) const
inline

Definition at line 1364 of file qcustomplot.h.

◆ rescale() [1/2]

void QCPAxis::rescale ( bool  onlyVisiblePlottables = false)

Changes the axis range such that all plottables associated with this axis are fully visible in that dimension.

See also
QCPAbstractPlottable::rescaleAxes, QCustomPlot::rescaleAxes

Definition at line 8627 of file qcustomplot.cpp.

References QCPRange::expand(), QCPRange::lower, mRange, mScaleType, plottables(), QCP::sdBoth, QCP::sdNegative, QCP::sdPositive, setRange(), QCPRange::size(), stLinear, stLogarithmic, QCPRange::upper, and QCPRange::validRange().

Referenced by QCustomPlot::rescaleAxes().

◆ rescale() [2/2]

void QCPAxis::rescale ( bool  onlyVisiblePlottables = false)

◆ scaleLogBase()

double QCPAxis::scaleLogBase ( ) const
inline

Definition at line 1362 of file qcustomplot.h.

◆ scaleRange() [1/3]

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 8546 of file qcustomplot.cpp.

References range().

Referenced by wheelEvent(), and QCPAxisRect::wheelEvent().

◆ scaleRange() [2/3]

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).

See also
scaleRange(double factor)

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 8560 of file qcustomplot.cpp.

References QCPRange::lower, mRange, mScaleType, rangeChanged(), QCPRange::sanitizedForLinScale(), QCPRange::sanitizedForLogScale(), stLinear, QCPRange::upper, and QCPRange::validRange().

◆ scaleRange() [3/3]

void QCPAxis::scaleRange ( double  factor,
double  center 
)

◆ scaleType() [1/2]

◆ scaleType() [2/2]

ScaleType QCPAxis::scaleType ( ) const
inline

Definition at line 1361 of file qcustomplot.h.

◆ scaleTypeChanged [1/2]

void QCPAxis::scaleTypeChanged ( QCPAxis::ScaleType  scaleType)
signal

This signal is emitted when the scale type changes, by calls to setScaleType

Referenced by setScaleType().

◆ scaleTypeChanged [2/2]

void QCPAxis::scaleTypeChanged ( QCPAxis::ScaleType  scaleType)
signal

◆ selectableChanged [1/2]

void QCPAxis::selectableChanged ( const QCPAxis::SelectableParts &  parts)
signal

This signal is emitted when the selectability changes, by calls to setSelectableParts

◆ selectableChanged [2/2]

void QCPAxis::selectableChanged ( const QCPAxis::SelectableParts &  parts)
signal

◆ selectableParts() [1/2]

SelectableParts QCPAxis::selectableParts ( ) const
inline

Definition at line 2418 of file qcustomplot.h.

◆ selectableParts() [2/2]

SelectableParts QCPAxis::selectableParts ( ) const
inline

Definition at line 1400 of file qcustomplot.h.

◆ selectedBasePen() [1/2]

QPen QCPAxis::selectedBasePen ( ) const
inline

Definition at line 2423 of file qcustomplot.h.

◆ selectedBasePen() [2/2]

QPen QCPAxis::selectedBasePen ( ) const
inline

Definition at line 1405 of file qcustomplot.h.

◆ selectedLabelColor() [1/2]

QColor QCPAxis::selectedLabelColor ( ) const
inline

Definition at line 2422 of file qcustomplot.h.

◆ selectedLabelColor() [2/2]

QColor QCPAxis::selectedLabelColor ( ) const
inline

Definition at line 1404 of file qcustomplot.h.

◆ selectedLabelFont() [1/2]

QFont QCPAxis::selectedLabelFont ( ) const
inline

Definition at line 2420 of file qcustomplot.h.

◆ selectedLabelFont() [2/2]

QFont QCPAxis::selectedLabelFont ( ) const
inline

Definition at line 1402 of file qcustomplot.h.

◆ selectedParts() [1/2]

SelectableParts QCPAxis::selectedParts ( ) const
inline

Definition at line 2417 of file qcustomplot.h.

Referenced by QCustomPlot::selectedAxes().

◆ selectedParts() [2/2]

SelectableParts QCPAxis::selectedParts ( ) const
inline

Definition at line 1399 of file qcustomplot.h.

◆ selectedSubTickPen() [1/2]

QPen QCPAxis::selectedSubTickPen ( ) const
inline

Definition at line 2425 of file qcustomplot.h.

◆ selectedSubTickPen() [2/2]

QPen QCPAxis::selectedSubTickPen ( ) const
inline

Definition at line 1407 of file qcustomplot.h.

◆ selectedTickLabelColor() [1/2]

QColor QCPAxis::selectedTickLabelColor ( ) const
inline

Definition at line 2421 of file qcustomplot.h.

◆ selectedTickLabelColor() [2/2]

QColor QCPAxis::selectedTickLabelColor ( ) const
inline

Definition at line 1403 of file qcustomplot.h.

◆ selectedTickLabelFont() [1/2]

QFont QCPAxis::selectedTickLabelFont ( ) const
inline

Definition at line 2419 of file qcustomplot.h.

◆ selectedTickLabelFont() [2/2]

QFont QCPAxis::selectedTickLabelFont ( ) const
inline

Definition at line 1401 of file qcustomplot.h.

◆ selectedTickPen() [1/2]

QPen QCPAxis::selectedTickPen ( ) const
inline

Definition at line 2424 of file qcustomplot.h.

◆ selectedTickPen() [2/2]

QPen QCPAxis::selectedTickPen ( ) const
inline

Definition at line 1406 of file qcustomplot.h.

◆ selectEvent() [1/2]

void QCPAxis::selectEvent ( QMouseEvent *  event,
bool  additive,
const QVariant &  details,
bool *  selectionStateChanged 
)
protectedvirtual

Reimplemented from QCPLayerable.

Definition at line 8957 of file qcustomplot.cpp.

References event, mSelectableParts, mSelectedParts, and setSelectedParts().

◆ selectEvent() [2/2]

virtual void QCPAxis::selectEvent ( QMouseEvent *  event,
bool  additive,
const QVariant &  details,
bool *  selectionStateChanged 
)
protectedvirtual

Reimplemented from QCPLayerable.

◆ selectionCategory() [1/2]

QCP::Interaction QCPAxis::selectionCategory ( ) const
protectedvirtual

Reimplemented from QCPLayerable.

Definition at line 9341 of file qcustomplot.cpp.

References QCP::iSelectAxes.

◆ selectionCategory() [2/2]

virtual QCP::Interaction QCPAxis::selectionCategory ( ) const
protectedvirtual

Reimplemented from QCPLayerable.

◆ selectionChanged [1/2]

void QCPAxis::selectionChanged ( const QCPAxis::SelectableParts &  parts)
signal

◆ selectionChanged [2/2]

void QCPAxis::selectionChanged ( const QCPAxis::SelectableParts &  parts)
signal

◆ selectTest() [1/2]

double QCPAxis::selectTest ( const QPointF &  pos,
bool  onlySelectable,
QVariant *  details = 0 
) const
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.

See also
selectEvent, deselectEvent, mousePressEvent, wheelEvent, QCustomPlot::setInteractions, QCPAbstractPlottable1D::selectTestRect

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.

You may pass 0 as details to indicate that you are not interested in those selection details.

See also
selectEvent, deselectEvent, QCustomPlot::setInteractions

Reimplemented from QCPLayerable.

Definition at line 8837 of file qcustomplot.cpp.

References getPartAt(), QCPLayerable::mParentPlot, mSelectableParts, QCustomPlot::selectionTolerance(), and spNone.

◆ selectTest() [2/2]

virtual double QCPAxis::selectTest ( const QPointF &  pos,
bool  onlySelectable,
QVariant *  details = 0 
) const
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.

See also
selectEvent, deselectEvent, mousePressEvent, wheelEvent, QCustomPlot::setInteractions, QCPAbstractPlottable1D::selectTestRect

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.

You may pass 0 as details to indicate that you are not interested in those selection details.

See also
selectEvent, deselectEvent, QCustomPlot::setInteractions

Reimplemented from QCPLayerable.

◆ setAutoSubTicks()

void QCPAxis::setAutoSubTicks ( bool  on)

Sets whether the number of sub ticks in one tick interval is determined automatically. This works, as long as the tick step mantissa is a multiple of 0.5. When setAutoTickStep is enabled, this is always the case.

When on is set to false, you may set the sub tick count with setSubTickCount manually.

See also
setAutoTickCount, setAutoTicks, setAutoTickStep

Definition at line 4429 of file qcustomplot.cpp.

References mAutoSubTicks, and mCachedMarginValid.

◆ setAutoTickCount()

void QCPAxis::setAutoTickCount ( int  approximateCount)

When setAutoTickStep is true, approximateCount determines how many ticks should be generated in the visible range, approximately.

It's not guaranteed that this number of ticks is met exactly, but approximately within a tolerance of about two.

Only values greater than zero are accepted as approximateCount.

See also
setAutoTickStep, setAutoTicks, setAutoSubTicks

Definition at line 4363 of file qcustomplot.cpp.

References mAutoTickCount, and mCachedMarginValid.

◆ setAutoTickLabels()

void QCPAxis::setAutoTickLabels ( bool  on)

Sets whether the tick labels are generated automatically. Depending on the tick label type (ltNumber or ltDateTime), the labels will either show the coordinate as floating point number (setNumberFormat), or a date/time formatted according to setDateTimeFormat.

If on is set to false, you should provide the tick labels via setTickVectorLabels. This is usually used in a combination with setAutoTicks set to false for complete control over tick positions and labels, e.g. when the ticks should be at multiples of pi and show "2pi", "3pi" etc. as tick labels.

If you need dynamically calculated tick vectors (and possibly tick label vectors), set the vectors in a slot connected to the ticksRequest signal.

See also
setAutoTicks

Definition at line 4392 of file qcustomplot.cpp.

References mAutoTickLabels, and mCachedMarginValid.

◆ setAutoTicks()

void QCPAxis::setAutoTicks ( bool  on)

Sets whether the tick positions should be calculated automatically (either from an automatically generated tick step or a tick step provided manually via setTickStep, see setAutoTickStep).

If on is set to false, you must provide the tick positions manually via setTickVector. For these manual ticks you may let QCPAxis generate the appropriate labels automatically by leaving setAutoTickLabels set to true. If you also wish to control the displayed labels manually, set setAutoTickLabels to false and provide the label strings with setTickVectorLabels.

If you need dynamically calculated tick vectors (and possibly tick label vectors), set the vectors in a slot connected to the ticksRequest signal.

See also
setAutoTickLabels, setAutoSubTicks, setAutoTickCount, setAutoTickStep

Definition at line 4345 of file qcustomplot.cpp.

References mAutoTicks, and mCachedMarginValid.

◆ setAutoTickStep()

void QCPAxis::setAutoTickStep ( bool  on)

Sets whether the tick step, i.e. the interval between two (major) ticks, is calculated automatically. If on is set to true, the axis finds a tick step that is reasonable for human readable plots.

The number of ticks the algorithm aims for within the visible range can be specified with setAutoTickCount.

If on is set to false, you may set the tick step manually with setTickStep.

See also
setAutoTicks, setAutoSubTicks, setAutoTickCount

Definition at line 4412 of file qcustomplot.cpp.

References mAutoTickStep, and mCachedMarginValid.

◆ setBasePen() [1/2]

void QCPAxis::setBasePen ( const QPen &  pen)

Sets the pen, the axis base line is drawn with.

See also
setTickPen, setSubTickPen

Definition at line 8325 of file qcustomplot.cpp.

References mBasePen.

◆ setBasePen() [2/2]

void QCPAxis::setBasePen ( const QPen &  pen)

◆ setDateTimeFormat()

void QCPAxis::setDateTimeFormat ( const QString &  format)

Sets the format in which dates and times are displayed as tick labels, if setTickLabelType is ltDateTime. for details about the format string, see the documentation of QDateTime::toString().

Newlines can be inserted with "\n".

See also
setDateTimeSpec

Definition at line 4567 of file qcustomplot.cpp.

References format, mCachedMarginValid, and mDateTimeFormat.

◆ setDateTimeSpec()

void QCPAxis::setDateTimeSpec ( const Qt::TimeSpec &  timeSpec)

Sets the time spec that is used for the date time values when setTickLabelType is ltDateTime.

The default value of QDateTime objects (and also QCustomPlot) is Qt::LocalTime. However, if the date time values passed to QCustomPlot are given in the UTC spec, set timeSpec to Qt::UTC to get the correct axis labels.

See also
setDateTimeFormat

Definition at line 4585 of file qcustomplot.cpp.

References mDateTimeSpec.

◆ setLabel() [1/2]

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 8365 of file qcustomplot.cpp.

References mCachedMarginValid, and mLabel.

Referenced by AnglesCustomPlot::createQCPBars(), ccHistogramWindow::setAxisLabels(), ccWaveWidget::setAxisLabels(), and WolmanCustomPlot::WolmanCustomPlot().

◆ setLabel() [2/2]

void QCPAxis::setLabel ( const QString &  str)

◆ setLabelColor() [1/2]

void QCPAxis::setLabelColor ( const QColor &  color)

Sets the color of the axis label.

See also
setLabelFont

Definition at line 8358 of file qcustomplot.cpp.

References color, and mLabelColor.

◆ setLabelColor() [2/2]

void QCPAxis::setLabelColor ( const QColor &  color)

◆ setLabelFont() [1/2]

void QCPAxis::setLabelFont ( const QFont &  font)

Sets the font of the axis label.

See also
setLabelColor

Definition at line 8346 of file qcustomplot.cpp.

References mCachedMarginValid, and mLabelFont.

◆ setLabelFont() [2/2]

void QCPAxis::setLabelFont ( const QFont &  font)

◆ setLabelPadding() [1/2]

void QCPAxis::setLabelPadding ( int  padding)

Sets the distance between the tick labels and the axis label.

See also
setTickLabelPadding, setPadding

Definition at line 8377 of file qcustomplot.cpp.

References mAxisPainter, mCachedMarginValid, and padding().

Referenced by QCPAxis().

◆ setLabelPadding() [2/2]

void QCPAxis::setLabelPadding ( int  padding)

◆ setLowerEnding() [1/2]

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.

See also
setUpperEnding

Definition at line 8496 of file qcustomplot.cpp.

References mAxisPainter.

Referenced by QCPAxisRect::addAxis().

◆ setLowerEnding() [2/2]

void QCPAxis::setLowerEnding ( const QCPLineEnding ending)

◆ setNumberFormat() [1/2]

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.

Sets the number format for the numbers drawn as tick labels (if tick label type is ltNumber). 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.

If the scale type (setScaleType) is stLogarithmic and the formatCode uses the 'b' option (beautifully typeset decimal powers), the display usually is "1 [multiplication sign] 10 [superscript] n", which looks unnatural for logarithmic scaling (the "1 [multiplication sign]" part). To only display the decimal power, set the number precision to zero with setNumberPrecision.

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 8155 of file qcustomplot.cpp.

References mAxisPainter, mCachedMarginValid, mNumberBeautifulPowers, and mNumberFormatChar.

Referenced by QCPAxisRect::setupFullAxesBox().

◆ setNumberFormat() [2/2]

void QCPAxis::setNumberFormat ( const QString &  formatCode)

◆ setNumberPrecision() [1/2]

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

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

If the scale type (setScaleType) is stLogarithmic and the number format (setNumberFormat) uses the 'b' format code (beautifully typeset decimal powers), the display usually is "1 [multiplication sign] 10 [superscript] n", which looks unnatural for logarithmic scaling (the redundant "1 [multiplication sign]" part). To only display the decimal power "10 [superscript] n", set precision to zero.

Definition at line 8214 of file qcustomplot.cpp.

References mCachedMarginValid, and mNumberPrecision.

Referenced by QCPAxisRect::setupFullAxesBox().

◆ setNumberPrecision() [2/2]

void QCPAxis::setNumberPrecision ( int  precision)

◆ setOffset() [1/2]

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 8410 of file qcustomplot.cpp.

References mAxisPainter, and offset().

◆ setOffset() [2/2]

void QCPAxis::setOffset ( int  offset)

◆ setPadding() [1/2]

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.

See also
setLabelPadding, setTickLabelPadding

Definition at line 8395 of file qcustomplot.cpp.

References mCachedMarginValid, mPadding, and padding().

◆ setPadding() [2/2]

void QCPAxis::setPadding ( int  padding)

◆ setRange() [1/6]

void QCPAxis::setRange ( const QCPRange range)

◆ setRange() [2/6]

Q_SLOT void QCPAxis::setRange ( const QCPRange range)

◆ setRange() [3/6]

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 7922 of file qcustomplot.cpp.

References QCPRange::lower, mRange, mScaleType, rangeChanged(), QCPRange::sanitizedForLinScale(), QCPRange::sanitizedForLogScale(), stLogarithmic, QCPRange::upper, and QCPRange::validRange().

◆ setRange() [4/6]

void QCPAxis::setRange ( double  lower,
double  upper 
)

◆ setRange() [5/6]

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 7950 of file qcustomplot.cpp.

References position, setRange(), and size.

◆ setRange() [6/6]

void QCPAxis::setRange ( double  position,
double  size,
Qt::AlignmentFlag  alignment 
)

◆ setRangeLower() [1/2]

void QCPAxis::setRangeLower ( double  lower)

Sets the lower bound of the axis range. The upper bound is not changed.

See also
setRange

Definition at line 7965 of file qcustomplot.cpp.

References QCPRange::lower, mRange, mScaleType, rangeChanged(), QCPRange::sanitizedForLinScale(), QCPRange::sanitizedForLogScale(), and stLogarithmic.

◆ setRangeLower() [2/2]

void QCPAxis::setRangeLower ( double  lower)

◆ setRangeReversed() [1/2]

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 8007 of file qcustomplot.cpp.

References mRangeReversed.

Referenced by QCPAxisRect::setupFullAxesBox().

◆ setRangeReversed() [2/2]

void QCPAxis::setRangeReversed ( bool  reversed)

◆ setRangeUpper() [1/2]

void QCPAxis::setRangeUpper ( double  upper)

Sets the upper bound of the axis range. The lower bound is not changed.

See also
setRange

Definition at line 7983 of file qcustomplot.cpp.

References mRange, mScaleType, rangeChanged(), QCPRange::sanitizedForLinScale(), QCPRange::sanitizedForLogScale(), stLogarithmic, and QCPRange::upper.

◆ setRangeUpper() [2/2]

void QCPAxis::setRangeUpper ( double  upper)

◆ setScaleLogBase()

void QCPAxis::setScaleLogBase ( double  base)

If setScaleType is set to stLogarithmic, base will be the logarithm base of the scaling. In logarithmic axis scaling, major tick marks appear at all powers of base.

Properties like tick step (setTickStep) don't apply in logarithmic scaling. If you wish a decimal base but less major ticks, consider choosing base 100, 1000 or even higher.

Definition at line 4144 of file qcustomplot.cpp.

References mCachedMarginValid, mScaleLogBase, and mScaleLogBaseLogInv.

◆ setScaleRatio() [1/2]

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 8603 of file qcustomplot.cpp.

References axisRect(), QCPAxisRect::height(), orientation(), range(), setRange(), QCPRange::size(), and QCPAxisRect::width().

◆ setScaleRatio() [2/2]

void QCPAxis::setScaleRatio ( const QCPAxis otherAxis,
double  ratio = 1.0 
)

◆ setScaleType() [1/2]

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 :

qcpaxisticker-log-creation

See the documentation of QCPAxisTickerLog about the details of logarithmic axis tick creation.

setNumberPrecision

Sets whether the axis uses a linear scale or a logarithmic scale. If type is set to stLogarithmic, the logarithm base can be set with setScaleLogBase. In logarithmic axis scaling, major tick marks appear at all powers of the logarithm base. Properties like tick step (setTickStep) don't apply in logarithmic scaling. If you wish a decimal base but less major ticks, consider choosing a logarithm base of 100, 1000 or even higher.

If type is stLogarithmic and the number format (setNumberFormat) uses the 'b' option (beautifully typeset decimal powers), the display usually is "1 [multiplication sign] 10 [superscript] n", which looks unnatural for logarithmic scaling (the "1 [multiplication sign]" part). To only display the decimal power, set the number precision to zero with setNumberPrecision.

Definition at line 7837 of file qcustomplot.cpp.

References mCachedMarginValid, mRange, mScaleType, QCPRange::sanitizedForLogScale(), scaleTypeChanged(), setRange(), stLogarithmic, and type.

Referenced by QCPAxisRect::setupFullAxesBox(), and WolmanCustomPlot::WolmanCustomPlot().

◆ setScaleType() [2/2]

Q_SLOT void QCPAxis::setScaleType ( QCPAxis::ScaleType  type)

◆ setSelectableParts() [1/2]

Q_SLOT void QCPAxis::setSelectableParts ( const QCPAxis::SelectableParts &  selectableParts)

◆ setSelectableParts() [2/2]

Q_SLOT void QCPAxis::setSelectableParts ( const QCPAxis::SelectableParts &  selectableParts)

◆ setSelectedBasePen() [1/2]

void QCPAxis::setSelectedBasePen ( const QPen &  pen)

Sets the pen that is used to draw the axis base line when selected.

See also
setBasePen, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions

Definition at line 8466 of file qcustomplot.cpp.

References mSelectedBasePen.

◆ setSelectedBasePen() [2/2]

void QCPAxis::setSelectedBasePen ( const QPen &  pen)

◆ setSelectedLabelColor() [1/2]

void QCPAxis::setSelectedLabelColor ( const QColor &  color)

Sets the color that is used for the axis label when it is selected.

See also
setLabelColor, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions

Definition at line 8456 of file qcustomplot.cpp.

References color, and mSelectedLabelColor.

◆ setSelectedLabelColor() [2/2]

void QCPAxis::setSelectedLabelColor ( const QColor &  color)

◆ setSelectedLabelFont() [1/2]

void QCPAxis::setSelectedLabelFont ( const QFont &  font)

Sets the font that is used for the axis label when it is selected.

See also
setLabelFont, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions

Definition at line 8432 of file qcustomplot.cpp.

References mSelectedLabelFont.

◆ setSelectedLabelFont() [2/2]

void QCPAxis::setSelectedLabelFont ( const QFont &  font)

◆ setSelectedParts() [1/2]

Q_SLOT void QCPAxis::setSelectedParts ( const QCPAxis::SelectableParts &  selectedParts)

Referenced by deselectEvent(), and selectEvent().

◆ setSelectedParts() [2/2]

Q_SLOT void QCPAxis::setSelectedParts ( const QCPAxis::SelectableParts &  selectedParts)

◆ setSelectedSubTickPen() [1/2]

void QCPAxis::setSelectedSubTickPen ( const QPen &  pen)

Sets the pen that is used to draw the subticks when selected.

See also
setSubTickPen, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions

Definition at line 8482 of file qcustomplot.cpp.

References mSelectedSubTickPen.

◆ setSelectedSubTickPen() [2/2]

void QCPAxis::setSelectedSubTickPen ( const QPen &  pen)

◆ setSelectedTickLabelColor() [1/2]

void QCPAxis::setSelectedTickLabelColor ( const QColor &  color)

Sets the color that is used for tick labels when they are selected.

See also
setTickLabelColor, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions

Definition at line 8444 of file qcustomplot.cpp.

References color, and mSelectedTickLabelColor.

◆ setSelectedTickLabelColor() [2/2]

void QCPAxis::setSelectedTickLabelColor ( const QColor &  color)

◆ setSelectedTickLabelFont() [1/2]

void QCPAxis::setSelectedTickLabelFont ( const QFont &  font)

Sets the font that is used for tick labels when they are selected.

See also
setTickLabelFont, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions

Definition at line 8418 of file qcustomplot.cpp.

References mSelectedTickLabelFont.

◆ setSelectedTickLabelFont() [2/2]

void QCPAxis::setSelectedTickLabelFont ( const QFont &  font)

◆ setSelectedTickPen() [1/2]

void QCPAxis::setSelectedTickPen ( const QPen &  pen)

Sets the pen that is used to draw the (major) ticks when selected.

See also
setTickPen, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions

Definition at line 8474 of file qcustomplot.cpp.

References mSelectedTickPen.

◆ setSelectedTickPen() [2/2]

void QCPAxis::setSelectedTickPen ( const QPen &  pen)

◆ setSubTickCount()

void QCPAxis::setSubTickCount ( int  count)

Sets the number of sub ticks in one (major) tick step. A sub tick count of three for example, divides the tick intervals in four sub intervals.

By default, the number of sub ticks is chosen automatically in a reasonable manner as long as the mantissa of the tick step is a multiple of 0.5. When setAutoTickStep is enabled, this is always the case.

If you want to disable automatic sub tick count and use this function to set the count manually, see setAutoSubTicks.

Definition at line 4808 of file qcustomplot.cpp.

References count, and mSubTickCount.

◆ setSubTickLength() [1/2]

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.

See also
setTickLength, setSubTickLengthIn, setSubTickLengthOut

Definition at line 8287 of file qcustomplot.cpp.

References setSubTickLengthIn(), and setSubTickLengthOut().

Referenced by ccHistogramWindow::ccHistogramWindow(), and ccWaveWidget::ccWaveWidget().

◆ setSubTickLength() [2/2]

void QCPAxis::setSubTickLength ( int  inside,
int  outside = 0 
)

◆ setSubTickLengthIn() [1/2]

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.

See also
setSubTickLengthOut, setSubTickLength, setTickLength

Definition at line 8298 of file qcustomplot.cpp.

References mAxisPainter.

Referenced by setSubTickLength().

◆ setSubTickLengthIn() [2/2]

void QCPAxis::setSubTickLengthIn ( int  inside)

◆ setSubTickLengthOut() [1/2]

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.

See also
setSubTickLengthIn, setSubTickLength, setTickLength

Definition at line 8312 of file qcustomplot.cpp.

References mAxisPainter, and mCachedMarginValid.

Referenced by setSubTickLength().

◆ setSubTickLengthOut() [2/2]

void QCPAxis::setSubTickLengthOut ( int  outside)

◆ setSubTickPen() [1/2]

void QCPAxis::setSubTickPen ( const QPen &  pen)

Sets the pen, subtick marks will be drawn with.

See also
setSubTickCount, setSubTickLength, setBasePen

Definition at line 8339 of file qcustomplot.cpp.

References mSubTickPen.

◆ setSubTickPen() [2/2]

void QCPAxis::setSubTickPen ( const QPen &  pen)

◆ setSubTicks()

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)

See also
setTicks

Definition at line 8271 of file qcustomplot.cpp.

References mCachedMarginValid, and mSubTicks.

◆ setTicker()

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.

See also
ticker

Definition at line 8024 of file qcustomplot.cpp.

References mTicker, and ticker().

◆ setTickLabelColor() [1/2]

void QCPAxis::setTickLabelColor ( const QColor &  color)

Sets the color of the tick labels.

See also
setTickLabels, setTickLabelFont

Definition at line 8088 of file qcustomplot.cpp.

References color, and mTickLabelColor.

◆ setTickLabelColor() [2/2]

void QCPAxis::setTickLabelColor ( const QColor &  color)

◆ setTickLabelFont() [1/2]

void QCPAxis::setTickLabelFont ( const QFont &  font)

Sets the font of the tick labels.

See also
setTickLabels, setTickLabelColor

Definition at line 8076 of file qcustomplot.cpp.

References mCachedMarginValid, and mTickLabelFont.

◆ setTickLabelFont() [2/2]

void QCPAxis::setTickLabelFont ( const QFont &  font)

◆ setTickLabelPadding() [1/2]

void QCPAxis::setTickLabelPadding ( int  padding)

Sets the distance between the axis base line (including any outward ticks) and the tick labels.

See also
setLabelPadding, setPadding

Definition at line 8064 of file qcustomplot.cpp.

References mAxisPainter, mCachedMarginValid, and padding().

Referenced by QCPAxis().

◆ setTickLabelPadding() [2/2]

void QCPAxis::setTickLabelPadding ( int  padding)

◆ setTickLabelRotation() [1/2]

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 8101 of file qcustomplot.cpp.

References mAxisPainter, and mCachedMarginValid.

◆ setTickLabelRotation() [2/2]

void QCPAxis::setTickLabelRotation ( double  degrees)

◆ setTickLabels() [1/2]

void QCPAxis::setTickLabels ( bool  show)

Sets whether tick labels are displayed. Tick labels are the numbers drawn next to tick marks.

Definition at line 8052 of file qcustomplot.cpp.

References mCachedMarginValid, mTickLabels, and mTickVectorLabels.

Referenced by cvProbeFilter::createUi(), QCPAxisRect::setupFullAxesBox(), and sfEditDlg::sfEditDlg().

◆ setTickLabels() [2/2]

void QCPAxis::setTickLabels ( bool  show)

◆ setTickLabelSide() [1/2]

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 8117 of file qcustomplot.cpp.

References mAxisPainter, and mCachedMarginValid.

◆ setTickLabelSide() [2/2]

void QCPAxis::setTickLabelSide ( LabelSide  side)

◆ setTickLabelType()

void QCPAxis::setTickLabelType ( LabelType  type)

Sets whether the tick labels display numbers or dates/times.

If type is set to ltNumber, the format specifications of setNumberFormat apply.

If type is set to ltDateTime, the format specifications of setDateTimeFormat apply.

In QCustomPlot, date/time coordinates are double numbers representing the seconds since 1970-01-01T00:00:00 UTC. This format can be retrieved from QDateTime objects with the QDateTime::toTime_t() function. Since this only gives a resolution of one second, there is also the QDateTime::toMSecsSinceEpoch() function which returns the timespan described above in milliseconds. Divide its return value by 1000.0 to get a value with the format needed for date/time plotting, with a resolution of one millisecond.

Using the toMSecsSinceEpoch function allows dates that go back to 2nd January 4713 B.C. (represented by a negative number), unlike the toTime_t function, which works with unsigned integers and thus only goes back to 1st January

  1. So both for range and accuracy, use of toMSecsSinceEpoch()/1000.0 should be preferred as key coordinate for date/time axes.
See also
setTickLabels

Definition at line 4497 of file qcustomplot.cpp.

References mCachedMarginValid, mTickLabelType, and type.

◆ setTickLength() [1/2]

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.

See also
setSubTickLength, setTickLengthIn, setTickLengthOut

Definition at line 8230 of file qcustomplot.cpp.

References setTickLengthIn(), and setTickLengthOut().

Referenced by ccHistogramWindow::ccHistogramWindow(), and ccWaveWidget::ccWaveWidget().

◆ setTickLength() [2/2]

void QCPAxis::setTickLength ( int  inside,
int  outside = 0 
)

◆ setTickLengthIn() [1/2]

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.

See also
setTickLengthOut, setTickLength, setSubTickLength

Definition at line 8241 of file qcustomplot.cpp.

References mAxisPainter.

Referenced by setTickLength().

◆ setTickLengthIn() [2/2]

void QCPAxis::setTickLengthIn ( int  inside)

◆ setTickLengthOut() [1/2]

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.

See also
setTickLengthIn, setTickLength, setSubTickLength

Definition at line 8255 of file qcustomplot.cpp.

References mAxisPainter, and mCachedMarginValid.

Referenced by setTickLength().

◆ setTickLengthOut() [2/2]

void QCPAxis::setTickLengthOut ( int  outside)

◆ setTickPen() [1/2]

void QCPAxis::setTickPen ( const QPen &  pen)

Sets the pen, tick marks will be drawn with.

See also
setTickLength, setBasePen

Definition at line 8332 of file qcustomplot.cpp.

References mTickPen.

◆ setTickPen() [2/2]

void QCPAxis::setTickPen ( const QPen &  pen)

◆ setTicks() [1/2]

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.

See also
setSubTicks

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 8041 of file qcustomplot.cpp.

References mCachedMarginValid, and mTicks.

Referenced by QCPAxisRect::setupFullAxesBox().

◆ setTicks() [2/2]

void QCPAxis::setTicks ( bool  show)

◆ setTickStep()

void QCPAxis::setTickStep ( double  step)

If setAutoTickStep is set to false, use this function to set the tick step manually. The tick step is the interval between (major) ticks, in plot coordinates.

See also
setSubTickCount

Definition at line 4706 of file qcustomplot.cpp.

References mCachedMarginValid, and mTickStep.

◆ setTickVector()

void QCPAxis::setTickVector ( const QVector< double > &  vec)

If you want full control over what ticks (and possibly labels) the axes show, this function is used to set the coordinates at which ticks will appear.setAutoTicks must be disabled, else the provided tick vector will be overwritten with automatically generated tick coordinates upon replot. The labels of the ticks can be generated automatically when setAutoTickLabels is left enabled. If it is disabled, you can set the labels manually with setTickVectorLabels.

vec is a vector containing the positions of the ticks, in plot coordinates.

Warning
vec must be sorted in ascending order, no additional checks are made to ensure this.
See also
setTickVectorLabels

Definition at line 4729 of file qcustomplot.cpp.

References mCachedMarginValid, and mTickVector.

◆ setTickVectorLabels()

void QCPAxis::setTickVectorLabels ( const QVector< QString > &  vec)

If you want full control over what ticks and labels the axes show, this function is used to set a number of QStrings that will be displayed at the tick positions which you need to provide with setTickVector. These two vectors should have the same size. (Note that you need to disable setAutoTicks and setAutoTickLabels first.)

vec is a vector containing the labels of the ticks. The entries correspond to the respective indices in the tick vector, passed via setTickVector.

See also
setTickVector

Definition at line 4748 of file qcustomplot.cpp.

References mCachedMarginValid, and mTickVectorLabels.

◆ setUpperEnding() [1/2]

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.

See also
setLowerEnding

Definition at line 8510 of file qcustomplot.cpp.

References mAxisPainter.

Referenced by QCPAxisRect::addAxis().

◆ setUpperEnding() [2/2]

void QCPAxis::setUpperEnding ( const QCPLineEnding ending)

◆ setupTickVectors() [1/2]

◆ setupTickVectors() [2/2]

virtual void QCPAxis::setupTickVectors ( )
protectedvirtual

◆ subTickCount()

int QCPAxis::subTickCount ( ) const
inline

Definition at line 1387 of file qcustomplot.h.

Referenced by draw().

◆ subTickLengthIn() [1/2]

int QCPAxis::subTickLengthIn ( ) const

Definition at line 7804 of file qcustomplot.cpp.

References mAxisPainter.

◆ subTickLengthIn() [2/2]

int QCPAxis::subTickLengthIn ( ) const

◆ subTickLengthOut() [1/2]

int QCPAxis::subTickLengthOut ( ) const

Definition at line 7807 of file qcustomplot.cpp.

References mAxisPainter.

◆ subTickLengthOut() [2/2]

int QCPAxis::subTickLengthOut ( ) const

◆ subTickPen() [1/2]

QPen QCPAxis::subTickPen ( ) const
inline

Definition at line 2410 of file qcustomplot.h.

◆ subTickPen() [2/2]

QPen QCPAxis::subTickPen ( ) const
inline

Definition at line 1392 of file qcustomplot.h.

◆ subTicks()

bool QCPAxis::subTicks ( ) const
inline

Definition at line 2405 of file qcustomplot.h.

Referenced by QCPGrid::draw().

◆ ticker()

QSharedPointer< QCPAxisTicker > QCPAxis::ticker ( ) const
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.

See also
setTicker

Definition at line 2391 of file qcustomplot.h.

Referenced by setTicker(), QCPAxisRect::setupFullAxesBox(), and sfEditDlg::sfEditDlg().

◆ tickLabelColor() [1/2]

QColor QCPAxis::tickLabelColor ( ) const
inline

Definition at line 2396 of file qcustomplot.h.

◆ tickLabelColor() [2/2]

QColor QCPAxis::tickLabelColor ( ) const
inline

Definition at line 1375 of file qcustomplot.h.

◆ tickLabelFont() [1/2]

QFont QCPAxis::tickLabelFont ( ) const
inline

Definition at line 2395 of file qcustomplot.h.

◆ tickLabelFont() [2/2]

QFont QCPAxis::tickLabelFont ( ) const
inline

Definition at line 1374 of file qcustomplot.h.

◆ tickLabelPadding() [1/2]

int QCPAxis::tickLabelPadding ( ) const

Definition at line 7774 of file qcustomplot.cpp.

References mAxisPainter.

◆ tickLabelPadding() [2/2]

int QCPAxis::tickLabelPadding ( ) const

◆ tickLabelRotation() [1/2]

double QCPAxis::tickLabelRotation ( ) const

Definition at line 7777 of file qcustomplot.cpp.

References mAxisPainter.

◆ tickLabelRotation() [2/2]

double QCPAxis::tickLabelRotation ( ) const

◆ tickLabels() [1/2]

bool QCPAxis::tickLabels ( ) const
inline

Definition at line 2393 of file qcustomplot.h.

Referenced by calculateMargin(), and draw().

◆ tickLabels() [2/2]

bool QCPAxis::tickLabels ( ) const
inline

Definition at line 1371 of file qcustomplot.h.

◆ tickLabelSide() [1/2]

QCPAxis::LabelSide QCPAxis::tickLabelSide ( ) const

Definition at line 7782 of file qcustomplot.cpp.

References mAxisPainter.

◆ tickLabelSide() [2/2]

LabelSide QCPAxis::tickLabelSide ( ) const

◆ tickLabelType()

LabelType QCPAxis::tickLabelType ( ) const
inline

Definition at line 1373 of file qcustomplot.h.

◆ tickLengthIn() [1/2]

int QCPAxis::tickLengthIn ( ) const

Definition at line 7798 of file qcustomplot.cpp.

References mAxisPainter.

◆ tickLengthIn() [2/2]

int QCPAxis::tickLengthIn ( ) const

◆ tickLengthOut() [1/2]

int QCPAxis::tickLengthOut ( ) const

Definition at line 7801 of file qcustomplot.cpp.

References mAxisPainter.

◆ tickLengthOut() [2/2]

int QCPAxis::tickLengthOut ( ) const

◆ tickPen() [1/2]

QPen QCPAxis::tickPen ( ) const
inline

Definition at line 2409 of file qcustomplot.h.

◆ tickPen() [2/2]

QPen QCPAxis::tickPen ( ) const
inline

Definition at line 1391 of file qcustomplot.h.

◆ ticks() [1/2]

bool QCPAxis::ticks ( ) const
inline

Definition at line 2392 of file qcustomplot.h.

Referenced by QCPAxisRect::setupFullAxesBox().

◆ ticks() [2/2]

bool QCPAxis::ticks ( ) const
inline

Definition at line 1370 of file qcustomplot.h.

◆ ticksRequest

void QCPAxis::ticksRequest ( )
signal

This signal is emitted when setAutoTicks is false and the axis is about to generate tick labels for a replot.

Modifying the tick positions can be done with setTickVector. If you also want to control the tick labels, set setAutoTickLabels to false and also provide the labels with setTickVectorLabels.

If you only want static ticks you probably don't need this signal, since you can just set the tick vector (and possibly tick label vector) once. However, if you want to provide ticks (and maybe labels) dynamically, e.g. depending on the current axis range, connect a slot to this signal and set the vector/vectors there.

◆ tickStep()

double QCPAxis::tickStep ( ) const
inline

Definition at line 1382 of file qcustomplot.h.

Referenced by calculateAutoSubTickCount().

◆ tickVector() [1/2]

QVector<double> QCPAxis::tickVector ( ) const
inline

Definition at line 2401 of file qcustomplot.h.

◆ tickVector() [2/2]

QVector<double> QCPAxis::tickVector ( ) const
inline

Definition at line 1383 of file qcustomplot.h.

◆ tickVectorLabels() [1/2]

QVector<QString> QCPAxis::tickVectorLabels ( ) const
inline

Definition at line 2402 of file qcustomplot.h.

◆ tickVectorLabels() [2/2]

QVector<QString> QCPAxis::tickVectorLabels ( ) const
inline

Definition at line 1384 of file qcustomplot.h.

◆ upperEnding() [1/2]

QCPLineEnding QCPAxis::upperEnding ( ) const

Definition at line 7819 of file qcustomplot.cpp.

References mAxisPainter.

◆ upperEnding() [2/2]

QCPLineEnding QCPAxis::upperEnding ( ) const

◆ visibleTickBounds()

void QCPAxis::visibleTickBounds ( int &  lowIndex,
int &  highIndex 
) const
protected

Definition at line 5881 of file qcustomplot.cpp.

References QCPRange::lower, mRange, mTickVector, and QCPRange::upper.

◆ wheelEvent()

void QCPAxis::wheelEvent ( QWheelEvent *  event)
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.

See also
mousePressEvent, mouseMoveEvent, mouseReleaseEvent, mouseDoubleClickEvent

Reimplemented from QCPLayerable.

Definition at line 9097 of file qcustomplot.cpp.

References event, QCustomPlot::interactions(), QCP::iRangeZoom, mAxisRect, QCPLayerable::mParentPlot, orientation(), pixelToCoord(), qtCompatWheelEventDelta(), qtCompatWheelEventPos(), QCPAxisRect::rangeZoom(), QCPAxisRect::rangeZoomAxes(), QCPAxisRect::rangeZoomFactor(), QCustomPlot::replot(), and scaleRange().

Member Data Documentation

◆ mAADragBackup

QCP::AntialiasedElements QCPAxis::mAADragBackup
protected

Definition at line 2562 of file qcustomplot.h.

Referenced by mousePressEvent(), and mouseReleaseEvent().

◆ mAutoSubTicks

bool QCPAxis::mAutoSubTicks
protected

Definition at line 1536 of file qcustomplot.h.

Referenced by generateAutoTicks(), and setAutoSubTicks().

◆ mAutoTickCount

int QCPAxis::mAutoTickCount
protected

Definition at line 1535 of file qcustomplot.h.

Referenced by generateAutoTicks(), and setAutoTickCount().

◆ mAutoTickLabels

bool QCPAxis::mAutoTickLabels
protected

Definition at line 1521 of file qcustomplot.h.

Referenced by setAutoTickLabels().

◆ mAutoTicks

bool QCPAxis::mAutoTicks
protected

Definition at line 1536 of file qcustomplot.h.

Referenced by setAutoTicks().

◆ mAutoTickStep

bool QCPAxis::mAutoTickStep
protected

Definition at line 1536 of file qcustomplot.h.

Referenced by generateAutoTicks(), and setAutoTickStep().

◆ mAxisPainter

◆ mAxisRect

◆ mAxisType

AxisType QCPAxis::mAxisType
protected

Definition at line 2516 of file qcustomplot.h.

Referenced by calculateMargin(), and draw().

◆ mBasePen

QPen QCPAxis::mBasePen
protected

Definition at line 2522 of file qcustomplot.h.

Referenced by getBasePen(), and setBasePen().

◆ mCachedMargin

int QCPAxis::mCachedMargin
protected

Definition at line 2559 of file qcustomplot.h.

Referenced by calculateMargin().

◆ mCachedMarginValid

◆ mDateTimeFormat

QString QCPAxis::mDateTimeFormat
protected

Definition at line 1526 of file qcustomplot.h.

Referenced by setDateTimeFormat().

◆ mDateTimeSpec

Qt::TimeSpec QCPAxis::mDateTimeSpec
protected

Definition at line 1527 of file qcustomplot.h.

Referenced by setDateTimeSpec().

◆ mDragging

bool QCPAxis::mDragging
protected

Definition at line 2560 of file qcustomplot.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and mouseReleaseEvent().

◆ mDragStartRange

QCPRange QCPAxis::mDragStartRange
protected

Definition at line 2561 of file qcustomplot.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

◆ mGrid

QCPGrid * QCPAxis::mGrid
protected

Definition at line 2552 of file qcustomplot.h.

Referenced by QCPAxis(), setupTickVectors(), and ~QCPAxis().

◆ mHighestVisibleTick

int QCPAxis::mHighestVisibleTick
protected

Definition at line 1550 of file qcustomplot.h.

◆ mLabel

QString QCPAxis::mLabel
protected

Definition at line 2526 of file qcustomplot.h.

Referenced by calculateMargin(), draw(), and setLabel().

◆ mLabelColor

QColor QCPAxis::mLabelColor
protected

Definition at line 2528 of file qcustomplot.h.

Referenced by getLabelColor(), and setLabelColor().

◆ mLabelFont

QFont QCPAxis::mLabelFont
protected

Definition at line 2527 of file qcustomplot.h.

Referenced by getLabelFont(), and setLabelFont().

◆ mLowestVisibleTick

int QCPAxis::mLowestVisibleTick
protected

Definition at line 1550 of file qcustomplot.h.

◆ mNotAADragBackup

QCP::AntialiasedElements QCPAxis::mNotAADragBackup
protected

Definition at line 2562 of file qcustomplot.h.

Referenced by mousePressEvent(), and mouseReleaseEvent().

◆ mNumberBeautifulPowers

bool QCPAxis::mNumberBeautifulPowers
protected

Definition at line 2537 of file qcustomplot.h.

Referenced by draw(), numberFormat(), and setNumberFormat().

◆ mNumberFormatChar

QLatin1Char QCPAxis::mNumberFormatChar
protected

Definition at line 2536 of file qcustomplot.h.

Referenced by numberFormat(), setNumberFormat(), and setupTickVectors().

◆ mNumberPrecision

int QCPAxis::mNumberPrecision
protected

Definition at line 2535 of file qcustomplot.h.

Referenced by setNumberPrecision(), and setupTickVectors().

◆ mOrientation

Qt::Orientation QCPAxis::mOrientation
protected

Definition at line 2520 of file qcustomplot.h.

◆ mPadding

int QCPAxis::mPadding
protected

Definition at line 2519 of file qcustomplot.h.

Referenced by calculateMargin(), and setPadding().

◆ mRange

◆ mRangeReversed

bool QCPAxis::mRangeReversed
protected

Definition at line 2548 of file qcustomplot.h.

Referenced by coordToPixel(), draw(), pixelToCoord(), and setRangeReversed().

◆ mScaleLogBase

double QCPAxis::mScaleLogBase
protected

Definition at line 1545 of file qcustomplot.h.

Referenced by basePow(), generateAutoTicks(), and setScaleLogBase().

◆ mScaleLogBaseLogInv

double QCPAxis::mScaleLogBaseLogInv
protected

Definition at line 1545 of file qcustomplot.h.

Referenced by baseLog(), and setScaleLogBase().

◆ mScaleType

◆ mSelectableParts

SelectableParts QCPAxis::mSelectableParts
protected

Definition at line 2521 of file qcustomplot.h.

Referenced by deselectEvent(), selectEvent(), and selectTest().

◆ mSelectedBasePen

QPen QCPAxis::mSelectedBasePen
protected

Definition at line 2522 of file qcustomplot.h.

Referenced by getBasePen(), and setSelectedBasePen().

◆ mSelectedLabelColor

QColor QCPAxis::mSelectedLabelColor
protected

Definition at line 2528 of file qcustomplot.h.

Referenced by getLabelColor(), and setSelectedLabelColor().

◆ mSelectedLabelFont

QFont QCPAxis::mSelectedLabelFont
protected

Definition at line 2527 of file qcustomplot.h.

Referenced by getLabelFont(), and setSelectedLabelFont().

◆ mSelectedParts

SelectableParts QCPAxis::mSelectedParts
protected

◆ mSelectedSubTickPen

QPen QCPAxis::mSelectedSubTickPen
protected

Definition at line 2545 of file qcustomplot.h.

Referenced by getSubTickPen(), and setSelectedSubTickPen().

◆ mSelectedTickLabelColor

QColor QCPAxis::mSelectedTickLabelColor
protected

Definition at line 2534 of file qcustomplot.h.

Referenced by getTickLabelColor(), and setSelectedTickLabelColor().

◆ mSelectedTickLabelFont

QFont QCPAxis::mSelectedTickLabelFont
protected

Definition at line 2533 of file qcustomplot.h.

Referenced by getTickLabelFont(), and setSelectedTickLabelFont().

◆ mSelectedTickPen

QPen QCPAxis::mSelectedTickPen
protected

Definition at line 2544 of file qcustomplot.h.

Referenced by getTickPen(), and setSelectedTickPen().

◆ mSubTickCount

int QCPAxis::mSubTickCount
protected

Definition at line 1535 of file qcustomplot.h.

Referenced by calculateAutoSubTickCount(), generateAutoTicks(), and setSubTickCount().

◆ mSubTickPen

QPen QCPAxis::mSubTickPen
protected

Definition at line 2545 of file qcustomplot.h.

Referenced by getSubTickPen(), and setSubTickPen().

◆ mSubTicks

bool QCPAxis::mSubTicks
protected

Definition at line 2541 of file qcustomplot.h.

Referenced by draw(), setSubTicks(), and setupTickVectors().

◆ mSubTickVector

QVector< double > QCPAxis::mSubTickVector
protected

Definition at line 2557 of file qcustomplot.h.

Referenced by draw(), QCPGrid::drawSubGridLines(), and setupTickVectors().

◆ mTicker

QSharedPointer<QCPAxisTicker> QCPAxis::mTicker
protected

Definition at line 2554 of file qcustomplot.h.

Referenced by setTicker(), and setupTickVectors().

◆ mTickLabelColor

QColor QCPAxis::mTickLabelColor
protected

Definition at line 2534 of file qcustomplot.h.

Referenced by getTickLabelColor(), and setTickLabelColor().

◆ mTickLabelFont

QFont QCPAxis::mTickLabelFont
protected

Definition at line 2533 of file qcustomplot.h.

Referenced by calculateMargin(), getTickLabelFont(), and setTickLabelFont().

◆ mTickLabels

bool QCPAxis::mTickLabels
protected

Definition at line 2531 of file qcustomplot.h.

Referenced by calculateMargin(), draw(), setTickLabels(), and setupTickVectors().

◆ mTickLabelType

LabelType QCPAxis::mTickLabelType
protected

Definition at line 1523 of file qcustomplot.h.

Referenced by setTickLabelType().

◆ mTickPen

QPen QCPAxis::mTickPen
protected

Definition at line 2544 of file qcustomplot.h.

Referenced by getTickPen(), and setTickPen().

◆ mTicks

bool QCPAxis::mTicks
protected

Definition at line 2540 of file qcustomplot.h.

Referenced by calculateMargin(), draw(), setTicks(), and setupTickVectors().

◆ mTickStep

double QCPAxis::mTickStep
protected

Definition at line 1534 of file qcustomplot.h.

Referenced by generateAutoTicks(), and setTickStep().

◆ mTickVector

QVector< double > QCPAxis::mTickVector
protected

◆ mTickVectorLabels

QVector< QString > QCPAxis::mTickVectorLabels
protected

The documentation for this class was generated from the following files: