QLogValueAxis Class

QLogValueAxis 类为图表坐标轴添加对数刻度。更多

Header: #include <QLogValueAxis>
In QML: LogValueAxis
Inherits: QAbstractAxis

属性

公共函数

QLogValueAxis(QObject *parent = nullptr)
virtual ~QLogValueAxis()
qreal base() const
QString labelFormat() const
qreal max() const
qreal min() const
int minorTickCount() const
void setBase(qreal base)
void setLabelFormat(const QString &format)
void setMax(qreal max)
void setMin(qreal min)
void setMinorTickCount(int minorTickCount)
void setRange(qreal min, qreal max)
int tickCount() const

重新实现的公共函数

virtual QAbstractAxis::AxisType type() const override

信号

void baseChanged(qreal base)
void labelFormatChanged(const QString &format)
void maxChanged(qreal max)
void minChanged(qreal min)
void minorTickCountChanged(int minorTickCount)
void rangeChanged(qreal min, qreal max)
void tickCountChanged(int tickCount)

详细说明

对数刻度是基于数量级的非线性刻度,因此坐标轴上的每个刻度标记都是前一个刻度标记乘以一个值。

注意: 如果 QLogValueAxis 连接到的序列有一个或多个点,且相关维度上的值为负或零,则根本不会绘制该序列。这一点在使用 XYModelMappers 时尤为重要,因为模型中的空单元格通常包含零值。

属性文档

base : qreal

该属性表示对数的基数。

该值必须大于 0,且不能等于 1。

访问功能:

qreal base() const
void setBase(qreal base)

通知信号:

void baseChanged(qreal base)

labelFormat : QString

该属性用于保存轴的标签格式。

格式字符串支持printf() 在标准 C++ 库中提供的以下转换指定符、长度修饰符和标志:d、i、o、x、X、f、F、e、E、g、G、c。

如果QChart::localizeNumberstrue ,支持的指定符仅限于:d、e、E、f、g、G 和 i。此外,只支持精度修饰符。其余格式来自应用程序的默认QLocale

访问功能:

QString labelFormat() const
void setLabelFormat(const QString &format)

Notifier 信号:

void labelFormatChanged(const QString &format)

另请参见 QString::asprintf().

max : qreal

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

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

访问功能:

qreal max() const
void setMax(qreal max)

通知信号:

void maxChanged(qreal max)

min : qreal

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

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

访问功能:

qreal min() const
void setMin(qreal min)

通知信号:

void minChanged(qreal min)

minorTickCount : int

该属性表示坐标轴上小刻度线的数量。这表示在图表上的主要刻度线之间绘制了多少条网格线。小刻度线不绘制标签。默认值为 0。默认值为 0。将该值设置为-1,主要刻度线之间的网格线数将自动计算。

访问功能:

int minorTickCount() const
void setMinorTickCount(int minorTickCount)

通知信号:

void minorTickCountChanged(int minorTickCount)

[read-only] tickCount : const int

该属性表示坐标轴上刻度线的数量。这表示在图表上绘制了多少条网格线。该值为只读值。

访问功能

int tickCount() const

Notifier 信号:

void tickCountChanged(int tickCount)

成员函数 文档

[explicit] QLogValueAxis::QLogValueAxis(QObject *parent = nullptr)

构造一个轴对象,它是parent 的子对象。

[virtual noexcept] QLogValueAxis::~QLogValueAxis()

销毁对象。

[signal] void QLogValueAxis::baseChanged(qreal base)

base 轴的对数发生变化时,将发出该信号。

注: 属性base 的通知信号。

[signal] void QLogValueAxis::labelFormatChanged(const QString &format)

format 轴标签发生变化时会发出该信号。

注: 属性labelFormat 的通知信号。

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

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

注: 属性max 的通知信号。

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

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

注: 属性min 的通知信号。

[signal] void QLogValueAxis::minorTickCountChanged(int minorTickCount)

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

注: 属性minorTickCount 的通知信号。

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

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

void QLogValueAxis::setRange(qreal min, qreal max)

设置坐标轴上从minmax 的范围。如果min 大于max ,则返回,不做任何更改。

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

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

注: 属性tickCount 的通知信号。

[override virtual] QAbstractAxis::AxisType QLogValueAxis::type() const

重实现:QAbstractAxis::type() 常量。

返回轴的类型。

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