- Qt 6.12
- Qt Graphs
- C++ Classes
- QtGraphs
- QLogValueAxis
- Qt Graphs | Commercial or GPLv3

# QLogValueAxis Class

The QLogValueAxis class adds logarithmic values to a graph's axes. More...

Header: | `#include <QLogValueAxis>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Graphs)` `target_link_libraries(mytarget PRIVATE Qt6::Graphs)`
qmake: | `QT += graphs`
Since: | Qt 6.12
In QML: | LogValueAxis
Inherits: | QAbstractAxis

- List of all members, including inherited members
- QLogValueAxis is part of Qt Graphs C++ Classes for 2D.

## Properties

base : qreal labelFormat : QString `(since 6.12)` labelPostFormat : QString labelPrecision : int max : qreal min : qreal | pan : qreal subTickCount : qsizetype tickCount : int visualMax : qreal visualMin : qreal zoom : qreal

## Public Functions

| QLogValueAxis(QObject *parent = nullptr)
virtual | ~QLogValueAxis() override
qreal | base() const
QString | labelFormat() const
QString | labelPostFormat() const
int | labelPrecision() const
qreal | max() const
qreal | min() const
qreal | pan() const
void | setBase(qreal base)
void | setLabelFormat(const QString &format)
void | setLabelPostFormat(const QString &format)
void | setLabelPrecision(int decimals)
void | setMax(qreal max)
void | setMin(qreal min)
void | setPan(qreal pan)
void | setRange(qreal min, qreal max)
void | setSubTickCount(qsizetype count)
void | setZoom(qreal zoom)
qsizetype | subTickCount() const
qsizetype | tickCount() const
qreal | visualMax() const
qreal | visualMin() const
qreal | zoom() const

## Reimplemented Public Functions

virtual QAbstractAxis::AxisType | type() const override

## Signals

void | baseChanged(qreal base)
void | labelFormatChanged(const QString &format)
void | labelPostFormatChanged(const QString &format)
void | labelPrecisionChanged(int precision)
void | maxChanged(qreal max)
void | minChanged(qreal min)
void | panChanged(qreal pan)
void | subTickCountChanged(qsizetype subTickCount)
void | tickCountChanged(qsizetype tickCount)
void | visualMaxChanged(qreal visualMax)
void | visualMinChanged(qreal visualMin)
void | zoomChanged(qreal zoom)

## Reimplemented Protected Functions

virtual bool | event(QEvent *event) override

## Detailed Description

A logarithmic value axis can be set up to show an axis line with tick marks, grid lines, and shades. The values on the axis are drawn at the positions of tick marks.

## Property Documentation

### base : qreal

This base of the logarithm.

The value has to be greater than 0 and cannot equal 1. The default value is 10.0

Access functions:

qreal | base() const
void | setBase(qreal base)

Notifier signal:

void | baseChanged(qreal base)

### labelFormat : QString

This property holds the label format of the axis.

The format string supports the following conversion specifiers, length modifiers, and flags provided by `printf()` in the standard C++ library: d, i, o, x, X, f, F, e, E, g, G, c. Then the formatted string goes through QLogValueAxis::labelPostFormat.

The default value is empty, in which case 'f' format is used.

Access functions:

QString | labelFormat() const
void | setLabelFormat(const QString &format)

Notifier signal:

void | labelFormatChanged(const QString &format)

See also QString::asprintf().

### `[since 6.12]` labelPostFormat : QString

This property holds the label post format of the axis.

The label first goes through QLogValueAxis::labelFormat to format the value, then goes through this.

The default value is "%1".

This enumeration was introduced in Qt 6.12.

Access functions:

QString | labelPostFormat() const
void | setLabelPostFormat(const QString &format)

Notifier signal:

void | labelPostFormatChanged(const QString &format)

See also QString::arg().

### labelPrecision : int

This property holds the maximum number of significant digits used for showing the labels. The default value is 6. Any negative precision is ignored in favor of the default, 6.

Access functions:

int | labelPrecision() const
void | setLabelPrecision(int decimals)

Notifier signal:

void | labelPrecisionChanged(int precision)

### max : qreal

This property holds the maximum value on the axis.

When setting this property, the minimum value is adjusted if necessary, to ensure that the range remains valid. The default value is 10.0

Access functions:

qreal | max() const
void | setMax(qreal max)

Notifier signal:

void | maxChanged(qreal max)

### min : qreal

This property holds the minimum value on the axis.

When setting this property, the maximum value is adjusted if necessary, to ensure that the range remains valid. The default value is 0.0

Access functions:

qreal | min() const
void | setMin(qreal min)

Notifier signal:

void | minChanged(qreal min)

### pan : qreal

This property holds the pan value of the axis.

The pan value moves the center of the axis without affecting intervals of grid and labels. The default value is 0.

Access functions:

qreal | pan() const
void | setPan(qreal pan)

Notifier signal:

void | panChanged(qreal pan)

### subTickCount : qsizetype

This property holds the number of subticks on the axis. This indicates how many subticks are drawn between major lines on the graph. Labels are not drawn for subticks. Set the value to -1 and the number of subticks will be set equal to the closest integer value of the logarithm base. The default value is -1.

Access functions:

qsizetype | subTickCount() const
void | setSubTickCount(qsizetype count)

Notifier signal:

void | subTickCountChanged(qsizetype subTickCount)

### `[read-only]` tickCount : int

This property holds the number of tick marks on the axis. This value is read-only.

Access functions:

qsizetype | tickCount() const

Notifier signal:

void | tickCountChanged(qsizetype tickCount)

### `[read-only]` visualMax : qreal

This property holds the visual maximum value of the axis.

This property holds a a visual maximum axis value when axis has been panned or zoomed. The default value is QLogValueAxis::max

Access functions:

qreal | visualMax() const

Notifier signal:

void | visualMaxChanged(qreal visualMax)

### `[read-only]` visualMin : qreal

This property holds the visual minimum value of the axis.

This property holds a a visual minimum axis value when axis has been panned or zoomed. The default value is QLogValueAxis::min

Access functions:

qreal | visualMin() const

Notifier signal:

void | visualMinChanged(qreal visualMin)

### zoom : qreal

This property holds the zoom value of the axis.

The zoom value enlarges or shrinks the axis and thus the graph without affecting intervals of grid and labels. The default value is 1.

Access functions:

qreal | zoom() const
void | setZoom(qreal zoom)

Notifier signal:

void | zoomChanged(qreal zoom)

## Member Function Documentation

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

Constructs an axis object that is a child of parent.

### `[override virtual noexcept]` QLogValueAxis::~QLogValueAxis()

Destroys the object.

### `[override virtual protected]` bool QLogValueAxis::event(QEvent *event)

Reimplements: QObject::event(QEvent *e).

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

Sets the range from min to max on the axis. If min is greater than max, this function returns without making any changes.

### `[override virtual]` QAbstractAxis::AxisType QLogValueAxis::type() const

Reimplements: QAbstractAxis::type() const.

Returns the type of the axis.