Qt 5.9 | Qt Charts | QML Types | ValueAxis QML Type

Qt 5.9.9 Reference Documentation

# ValueAxis QML Type

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

Import Statement: | import QtCharts 2.2
Instantiates: | QValueAxis
Inherits: | AbstractAxis

- List of all members, including inherited members

## Properties

- labelFormat : real
- max : real
- min : real
- minorTickCount : int
- tickCount : int

## Signals

- rangeChanged(string min, string max)

## Methods

- applyNiceNumbers()

## 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:

      ChartView {
          ValueAxis {
              id: xAxis
              min: 0
              max: 10
          }
      // Add a few series...
      }

## Property Documentation

labelFormat : real

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.

If ChartView.localizeNumbers is `true`, the supported specifiers are limited to: d, e, E, f, g, G, and i. Also, only the precision modifier is supported. The rest of the formatting comes from the default QLocale of the application.

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.

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.

minorTickCount : int

The number of minor tick marks on the axis. This indicates how many grid lines are drawn between major ticks on the chart. Labels are not drawn for minor ticks. The default value is 0.

tickCount : int

The number of tick marks on the axis. This indicates how many grid lines are drawn on the chart. The default value is 5, and the number cannot be less than 2.

## Signal Documentation

rangeChanged(string min, string max)

This signal is emitted when min or max value of the axis changes.

The corresponding signal handler is `onRangeChanged`.

## Method Documentation

applyNiceNumbers()

Modifies the current range and number of tick marks on the axis to look nice. The algorithm considers numbers that can be expressed as a form of 1*10^n, 2* 10^n, or 5*10^n to be nice numbers. These numbers are used for setting spacing for the tick marks.