QDateTimeAxis Class | Qt Graphs | Qt 6.12.0
Description: The QDateTimeAxis adds support for DateTime values to be added to a graph's axis.
Keywords: class

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

# QDateTimeAxis Class

The QDateTimeAxis adds support for DateTime values to be added to a graph's axis. More...

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

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

## Properties

labelFormat : QString max : QDateTime min : QDateTime `(since 6.11)` pan : qreal subTickCount : int | `(since 6.12)` tickCount : qreal `(since 6.11)` timeZone : QTimeZone `(since 6.11)` visualMax : QDateTime `(since 6.11)` visualMin : QDateTime `(since 6.11)` zoom : qreal

## Public Functions

QString | labelFormat() const
QDateTime | max() const
QDateTime | min() const
qreal | pan() const
void | setLabelFormat(const QString &format)
void | setMax(const QDateTime &max)
void | setMin(const QDateTime &min)
void | setPan(qreal pan)
void | setSubTickCount(int newSubTickCount)
void | setTickCount(qreal count)
void | setTimeZone(const QTimeZone &zoneId)
void | setZoom(qreal zoom)
int | subTickCount() const
qreal | tickCount() const
QTimeZone | timeZone() const
QDateTime | visualMax() const
QDateTime | visualMin() const
qreal | zoom() const

## Signals

void | labelFormatChanged(const QString &format)
void | maxChanged(const QDateTime &max)
void | minChanged(const QDateTime &min)
void | panChanged(qreal newPan)
void | subTickCountChanged()
void | tickCountChanged(qreal count)
void | timeZoneChanged(const QTimeZone &newTimeZone)
void | visualMaxChanged(const QDateTime &newMax)
void | visualMaxChanged(qreal newMax)
void | visualMinChanged(const QDateTime &newMin)
void | visualMinChanged(qreal newMin)
void | zoomChanged(qreal newZoom)

## Detailed Description

A DateTime Axis can be used to display DateTime representations with tick marks and grid lines. The DateTime items on the axis are displayed at the position of the ticks.

## Property Documentation

### labelFormat : QString

This property holds the format of the DateTime labels on the axis. The format property allows to signify the visual representation of the DateTime object, in days, months, and years. The default value is dd-MMMM-yy.

Access functions:

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

Notifier signal:

void | labelFormatChanged(const QString &format)

### max : QDateTime

This property holds the maximum value on the axis

This value can be lower or higher than the minimum. The DateTime is stored as UTC internally. The default value is new Date(1980,1,1)

Access functions:

QDateTime | max() const
void | setMax(const QDateTime &max)

Notifier signal:

void | maxChanged(const QDateTime &max)

### min : QDateTime

This property holds the minimum value on the axis

This value can be lower or higher than the maximum. The DateTime is stored as UTC internally. The default value is new Date(1970,1,1)

Access functions:

QDateTime | min() const
void | setMin(const QDateTime &min)

Notifier signal:

void | minChanged(const QDateTime &min)

### `[since 6.11]` 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.

This enumeration was introduced in Qt 6.11.

Access functions:

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

Notifier signal:

void | panChanged(qreal newPan)

### subTickCount : int

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. The default value is 0.

Access functions:

int | subTickCount() const
void | setSubTickCount(int newSubTickCount)

Notifier signal:

void | subTickCountChanged()

### `[since 6.12]` tickCount : qreal

This property holds the amount of major ticks placed on an axis. If the value is 0 or lower, the axis automatically calculates the appropriate amount of ticks. The default value is 0.

This enumeration was introduced in Qt 6.12.

Access functions:

qreal | tickCount() const
void | setTickCount(qreal count)

Notifier signal:

void | tickCountChanged(qreal count)

### `[since 6.11]` timeZone : QTimeZone

This property holds the time zone that will be used to display labels of the axis. The accepted values are based on IANA time zone IDs. The default time zone is UTC.

This enumeration was introduced in Qt 6.11.

Access functions:

QTimeZone | timeZone() const
void | setTimeZone(const QTimeZone &zoneId)

Notifier signal:

void | timeZoneChanged(const QTimeZone &newTimeZone)

### `[read-only, since 6.11]` visualMax : QDateTime

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 QDateTimeAxis::max

This enumeration was introduced in Qt 6.11.

Access functions:

QDateTime | visualMax() const

Notifier signal:

void | visualMaxChanged(const QDateTime &newMax)
void | visualMaxChanged(qreal newMax)

### `[read-only, since 6.11]` visualMin : QDateTime

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 QDateTimeAxis::min

This enumeration was introduced in Qt 6.11.

Access functions:

QDateTime | visualMin() const

Notifier signal:

void | visualMinChanged(const QDateTime &newMin)
void | visualMinChanged(qreal newMin)

### `[since 6.11]` 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.

This enumeration was introduced in Qt 6.11.

Access functions:

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

Notifier signal:

void | zoomChanged(qreal newZoom)