- Qt 6.11
- Qt Graphs
- QML Types
- QtGraphs
- ValueAxis
- Qt Graphs | Commercial or GPLv3

# ValueAxis QML Type

Adds values to a graph's axes. More...

Import Statement: | `import QtGraphs`
In C++: | QValueAxis
Inherits: | AbstractAxis

- List of all members, including inherited members
- ValueAxis is part of Qt Graphs QML Types for 2D.

## Properties

- labelDecimals : int
- labelFormat : string
- max : real
- min : real
- pan : real `(since 6.9)`
- subTickCount : int
- tickAnchor : real
- tickInterval : real
- zoom : real `(since 6.9)`

## Signals

- labelDecimalsChanged(int decimals)
- labelFormatChanged(string format)
- maxChanged(real max)
- minChanged(real min)
- rangeChanged(real min, real max)
- subTickCountChanged(int subTickCount)
- tickAnchorChanged(real tickAnchor)
- tickIntervalChanged(real tickInterval)

## Detailed Description

The ValueAxis type 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.

The following example code illustrates how to use the ValueAxis type:

     GraphsView {
         axisX: ValueAxis {
             max: 10
             tickInterval: 1
         }
         axisY: ValueAxis {
             min -20
             max: 40
         }
         LineSeries {
             // Add a few XYPoint data...
         }
     }

## Property Documentation

### labelDecimals : int

The number of decimals used for showing the labels. When set to -1, decimal amount is adjusted automatically based on the values range. The default value is -1.

### labelFormat : string

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.

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

See also QString::asprintf().

### max : real

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

### min : real

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

### pan : real `[since 6.9]`

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 property was introduced in Qt 6.9.

### subTickCount : int

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.

### tickAnchor : real

The base value where the dynamically placed tick marks and labels are started from. The default value is 0.

### tickInterval : real

The interval between dynamically placed tick marks and labels. The default value is 0, which means that intervals are automatically calculated based on the min and max range.

### zoom : real `[since 6.9]`

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 property was introduced in Qt 6.9.

## Signal Documentation

### labelDecimalsChanged(int decimals)

This signal is emitted when the amount of axis label decimals changes to decimals.

Note: The corresponding handler is `onLabelDecimalsChanged`.

### labelFormatChanged(string format)

This signal is emitted when the format of axis labels changes to format.

Note: The corresponding handler is `onLabelFormatChanged`.

### maxChanged(real max)

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

Note: The corresponding handler is `onMaxChanged`.

### minChanged(real min)

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

Note: The corresponding handler is `onMinChanged`.

### rangeChanged(real min, real max)

This signal is emitted when the minimum or maximum value of the axis changes to min and max, respectively.

Note: The corresponding handler is `onRangeChanged`.

### subTickCountChanged(int subTickCount)

This signal is emitted when the number of subticks on the axis, specified by subTickCount, changes.

Note: The corresponding handler is `onSubTickCountChanged`.

### tickAnchorChanged(real tickAnchor)

This signal is emitted when the tick anchoring value changes to tickAnchor.

Note: The corresponding handler is `onTickAnchorChanged`.

### tickIntervalChanged(real tickInterval)

This signal is emitted when the tick interval value, changes to tickInterval.

Note: The corresponding handler is `onTickIntervalChanged`.