QColorAxis Class

QColorAxis 类将色标显示为图表的一个坐标轴。更多

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

属性

公共功能

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

信号

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)

详细说明

可以设置颜色轴,以根据传递的梯度显示颜色刻度。根据 QXYSeries::colorby 方法中传入的数据,该刻度具有带标签的刻度线。

属性文档

autoRange : bool

该属性用于指示是应从QXYSeries::colorBy 方法传递的值列表中设置范围,还是应从坐标轴本身获取范围。

默认值为true

访问功能:

bool autoRange() const
void setAutoRange(bool autoRange)

通知信号:

void autoRangeChanged(bool autoRange)

max : qreal

该属性用于保存坐标轴上的最大值。

设置该属性时,如有必要,会对最小值进行调整,以确保范围保持有效。

访问功能:

qreal max() const
void setMax(qreal max)

通知信号:

void maxChanged(qreal max)

min : qreal

该属性用于保存坐标轴上的最小值。

设置该属性时,必要时会调整最大值,以确保范围保持有效。

访问功能:

qreal min() const
void setMin(qreal min)

通知信号:

void minChanged(qreal min)

size : qreal

该属性表示色标的大小。

根据对齐方式,该值表示宽度或高度。

访问功能

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

通知信号:

void sizeChanged(const qreal size)

tickCount : int

该属性用于保存坐标轴上刻度线的数量。如果 QColorAxis::gridVisible 等于true ,则表示在图表上绘制了多少条网格线。默认值为 5,且数量不能少于 2。

注意: QColorAxis 中,网格线默认是不可见的,因为这种类型的坐标轴不表示几何值。

访问功能:

int tickCount() const
void setTickCount(int count)

Notifier 信号:

void tickCountChanged(int tickCount)

成员函数文档

[virtual noexcept] QColorAxis::~QColorAxis()

销毁对象。

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

autoRange 指定的自动量程模式发生变化时,会发出该信号。

注: 属性autoRange 的通知信号。

QLinearGradient QColorAxis::gradient() const

返回当前在色标上使用的渐变。

注: 如果坐标轴与序列相连,QXYSeries::colorBy 方法也会使用该渐变。

另请参阅 setGradient

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

max 指定的轴的最大值发生变化时,将发出该信号。

注: 属性max 的通知信号。

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

min 指定的坐标轴最小值发生变化时,将发出该信号。

注: 属性min 的通知信号。

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

minmax 指定的轴的最小值或最大值发生变化时,将发出该信号。

void QColorAxis::setGradient(const QLinearGradient &gradient)

将色标上的梯度设置为gradient

注: 如果坐标轴与序列相连,QXYSeries::colorBy 方法也会使用渐变。

另请参阅 gradient

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

tickCount 指定的坐标轴上的刻度线数量发生变化时,将发出该信号。

注: 属性tickCount 的通知信号。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.