本页内容

QColorAxis Class

QColorAxis 类将颜色标尺作为图表的轴之一显示。更多...

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

该类已弃用。我们强烈建议不要在新代码中使用它。

属性

公共函数

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)

通知器信号:

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 的Notifier 信号。

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

当由min 指定的轴的最小值发生变化时,会触发此信号。

注意: 这是属性min的通知器 信号。

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

当由min 和max 指定的轴的最小值或最大值发生变化时,将发出此信号。

void QColorAxis::setGradient(const QLinearGradient &gradient)

将颜色标尺上的渐变设置为gradient 。

注意:如果 该坐标轴与某个系列相关联,则QXYSeries::colorBy 方法也会使用该渐变。

另请参阅 gradient 。

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

当由 `tickCount` 指定的坐标轴刻度数发生变化时,会触发此信号。

注意: 这是属性tickCount的通知器 信号。

© 2026 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.