- Qt 6.11
- Qt Charts
- C++ Classes
- QColorAxis
- Qt Charts | Commercial or GPLv3

# QColorAxis Class

The QColorAxis class displays a color scale as one of the chart's axes. More...

Header: | `#include <QColorAxis>`
Since: | Qt 6.2
Inherits: | QAbstractAxis

- List of all members, including inherited members

## Properties

autoRange : bool max : qreal min : qreal | size : qreal tickCount : int

## Public Functions

virtual | ~QColorAxis()
bool | autoRange() const
QLinearGradient | gradient() const
qreal | max() const
qreal | min() const
void | setAutoRange(bool autoRange)
void | setGradient(const QLinearGradient &gradient)
void | setMax(qreal max)
void | setMin(qreal min)
void | setSize(const qreal size)
void | setTickCount(int count)
qreal | size() const
int | tickCount() const

## Reimplemented Public Functions

virtual QAbstractAxis::AxisType | type() const override

## Signals

void | autoRangeChanged(bool autoRange)
void | maxChanged(qreal max)
void | minChanged(qreal min)
void | rangeChanged(qreal min, qreal max)
void | sizeChanged(const qreal size)
void | tickCountChanged(int tickCount)

## Detailed Description

A color axis can be set up to show a color scale based on the passed gradient. The scale has tick marks with labels based on data passed in QXYSeries::colorby method.

## Property Documentation

### autoRange : bool

This property holds the property indicating if the range should be set from the list of values passed in QXYSeries::colorBy method or rather taken from the axis itself.

The default value is `true`.

Access functions:

bool | autoRange() const
void | setAutoRange(bool autoRange)

Notifier signal:

void | autoRangeChanged(bool autoRange)

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

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.

Access functions:

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

Notifier signal:

void | minChanged(qreal min)

### size : qreal

This property holds the size of the color scale.

Depending on the alignment the value indicates either width or height.

Access functions:

qreal | size() const
void | setSize(const qreal size)

Notifier signal:

void | sizeChanged(const qreal size)

### tickCount : int

This property holds the number of tick marks on the axis. This indicates how many grid lines are drawn on the chart if QColorAxis::gridVisible is equal to `true`. The default value is 5, and the number cannot be less than 2.

Note: Grid lines are intentionally invisible by default in QColorAxis as this type of axis does not represent geometric values.

Access functions:

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

Notifier signal:

void | tickCountChanged(int tickCount)

## Member Function Documentation

### `[virtual noexcept]` QColorAxis::~QColorAxis()

Destroys the object.

### `[signal]` void QColorAxis::autoRangeChanged(bool autoRange)

This signal is emitted when the auto range mode, specified by autoRange, changes.

Note: Notifier signal for property autoRange.

### QLinearGradient QColorAxis::gradient() const

Returns the gradient currently used on the color scale.

Note: If the axis is attached to a series, the gradient is also used by the QXYSeries::colorBy method.

See also setGradient.

### `[signal]` void QColorAxis::maxChanged(qreal max)

This signal is emitted when the maximum value of the axis, specified by max, changes.

Note: Notifier signal for property max.

### `[signal]` void QColorAxis::minChanged(qreal min)

This signal is emitted when the minimum value of the axis, specified by min, changes.

Note: Notifier signal for property min.

### `[signal]` void QColorAxis::rangeChanged(qreal min, qreal max)

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

### void QColorAxis::setGradient(const QLinearGradient &gradient)

Sets the gradient on the color scale to gradient.

Note: If the axis is attached to a series, the gradient is also used by the QXYSeries::colorBy method.

See also gradient.

### `[signal]` void QColorAxis::tickCountChanged(int tickCount)

This signal is emitted when the number of tick marks on the axis, specified by tickCount, changes.

Note: Notifier signal for property tickCount.