6.0.0-rc4Source

QLogValueAxis Class

The QLogValueAxis class is an axis with a logarithmic scale. More…

Header#include <QLogValueAxis>
CMaketarget_link_libraries(app PRIVATE Nt::Charts)
ModuleNt Charts C++ Classes
InheritsQAbstractAxis

List of all members, including inherited members

Public Functions

QLogValueAxis(QObject *parent = nullptr)
~QLogValueAxis()
voidsetMin(qreal min)
qrealmin() const
voidsetMax(qreal max)
qrealmax() const
voidsetRange(qreal min, qreal max)
voidsetLabelFormat(const QString &format)
QStringlabelFormat() const
voidsetBase(qreal base)
qrealbase() const
inttickCount() const
voidsetMinorTickCount(int minorTickCount)
intminorTickCount() const

Reimplemented Public Functions

AxisTypetype() const

Signals

voidminChanged(qreal min)
voidmaxChanged(qreal max)
voidrangeChanged(qreal min, qreal max)
voidlabelFormatChanged(const QString &format)
voidbaseChanged(qreal base)
voidtickCountChanged(int tickCount)
voidminorTickCountChanged(int minorTickCount)

Reimplemented Protected Functions

voidsetRangeFromVariant(const QVariant &min, const QVariant &max)

Detailed Description

A logarithmic axis with minor grid lines

The axis maps positive values: equal ratios take equal room. It has a tick at each power of base() within its range, and minorTickCount() minor ticks between them.

auto *axisY = new QLogValueAxis;
axisY->setBase(10);
axisY->setLabelFormat("%g");
chart->addAxis(axisY, Qt::AlignLeft);
series->attachAxis(axisY);

Values that are zero or negative are not drawn.

See also QValueAxis.

Differences from Qt

Labels are formatted by Nt itself, as for QValueAxis.

Member Function Documentation

[explicit] QLogValueAxis::QLogValueAxis(QObject *parent = nullptr)

Constructs a logarithmic axis with the given parent. Its range is 1 to 1 until it is set or taken from the data.

[override] QLogValueAxis::~QLogValueAxis()

Destroys the axis.

qreal QLogValueAxis::base() const

Returns the base of the logarithm.

[signal] void QLogValueAxis::baseChanged(qreal base)

This signal is emitted when the base of the logarithm changes to base.

QString QLogValueAxis::labelFormat() const

Returns the format of the labels.

[signal] void QLogValueAxis::labelFormatChanged(const QString &format)

This signal is emitted when the label format changes to format.

qreal QLogValueAxis::max() const

Returns the maximum of the axis.

[signal] void QLogValueAxis::maxChanged(qreal max)

This signal is emitted when the maximum of the axis changes to max.

qreal QLogValueAxis::min() const

Returns the minimum of the axis.

[signal] void QLogValueAxis::minChanged(qreal min)

This signal is emitted when the minimum of the axis changes to min.

int QLogValueAxis::minorTickCount() const

Returns the number of minor ticks between two ticks. The default is 0.

[signal] void QLogValueAxis::minorTickCountChanged(int minorTickCount)

This signal is emitted when the number of minor ticks changes to minorTickCount.

[signal] void QLogValueAxis::rangeChanged(qreal min, qreal max)

This signal is emitted when the range of the axis changes to min and max.

void QLogValueAxis::setBase(qreal base)

Sets the base of the logarithm to base, which must be positive and not 1. The default is 10.

void QLogValueAxis::setLabelFormat(const QString &format)

Sets the format of the labels to format, as QValueAxis::setLabelFormat() does. The default format is empty, which writes each label as a number with up to six significant digits.

void QLogValueAxis::setMax(qreal max)

Sets the maximum of the axis to max, which must be positive.

void QLogValueAxis::setMin(qreal min)

Sets the minimum of the axis to min, which must be positive.

void QLogValueAxis::setMinorTickCount(int minorTickCount)

Sets the number of minor ticks between two ticks to minorTickCount.

void QLogValueAxis::setRange(qreal min, qreal max)

Sets the range of the axis to min and max. A range that is not positive, or whose minimum is larger than its maximum, is ignored.

[override, protected] void QLogValueAxis::setRangeFromVariant(const QVariant &min, const QVariant &max)

Reimplements QAbstractAxis::setRangeFromVariant().

Sets the range to min and max, converted to real numbers. An invalid variant leaves that end as it is.

int QLogValueAxis::tickCount() const

Returns the number of ticks: the powers of base() within the range.

[signal] void QLogValueAxis::tickCountChanged(int tickCount)

This signal is emitted when the number of ticks changes to tickCount.

[override] AxisType QLogValueAxis::type() const

Reimplements QAbstractAxis::type().

Returns QAbstractAxis::AxisTypeLogValue.