LogValueAxis QML Type
向图形的坐标轴添加数值。更多...
| Import Statement: | import QtGraphs |
| Since: | Qt 6.12 |
| In C++: | QLogValueAxis |
| Inherits: |
- 所有成员列表,包括继承的成员
- LogValueAxis 是Qt Graphs 2D QML 类型的一部分。
属性
- base : real
- labelFormat : string
- labelPostFormat : string
(since 6.12) - labelPrecision : int
- max : real
- min : real
- pan : real
- subTickCount : int
- tickCount : int
- visualMax : real
- visualMin : real
- zoom : real
信号
- labelFormatChanged(string format)
- labelPostFormatChanged(string format)
(since 6.12) - labelPrecisionChanged(int precision)
- maxChanged(real max)
- minChanged(real min)
- rangeChanged(real min, real max)
- subTickCountChanged(int subTickCount)
- tickCountChanged(int tickCount)
详细说明
LogValueAxis 类型可配置为显示带有刻度、网格线和阴影的坐标轴。坐标轴上的数值将绘制在刻度位置处。
以下示例代码演示了如何使用 LogValueAxis 类型:
GraphsView {
axisX: LogValueAxis {
min: 1
max: 10
}
axisY: LogValueAxis {
min 0.1
max: 100
}
LineSeries {
// Add a few XYPoint data...
}
}属性文档
base : real
对数的底数。
该值必须大于 0,且不能等于 1。默认值为 10.0
labelFormat : string
该格式字符串支持标准 C++ 库中printf() 提供的以下转换指定符、长度修饰符和标志:d、i、o、x、X、f、F、e、E、g、G、c。随后,格式化后的字符串将通过LogValueAxis::labelPostFormat 进行处理。
默认值为空,此时将使用“f”格式。
LogValueAxis {
titleText: "Temperature °C"
labelFormat: "%.2f"
labelPostFormat: "%1 °C"
// Results in "2.50 °C"
}另请参阅 QString::asprintf()。
labelPostFormat : string [since 6.12]
该标签首先通过LogValueAxis::labelFormat 对值进行格式化,然后经过此处处理。
默认值为“%1”。
LogValueAxis {
titleText: "Temperature °C"
labelFormat: "%.2f"
labelPostFormat: "%1 °C"
// Results in "2.50 °C"
}该属性在 Qt 6.12 中引入。
另请参阅 QString::arg()。
labelPrecision : int
用于显示标签的有效数字最大位数。默认值为 6。任何负数精度都会被忽略,系统将采用默认值 6。
max : real
轴上的最大值。
设置此属性时,系统会在必要时调整最小值,以确保范围保持有效。默认值为 10.0
min : real
轴上的最小值。
设置此属性时,系统会根据需要调整最大值,以确保数值范围保持有效。默认值为 0.0
pan : real
该轴的平移值。
平移值用于移动坐标轴的中心,同时不影响网格和刻度的间隔。默认值为 0。
subTickCount : int
轴上的子刻度数量。这表示图表中主刻度线之间绘制多少个子刻度。子刻度不显示标签。将该值设为 -1 时,子刻度数量将设置为对数底数的最近整数值。默认值为 -1。
tickCount : int [read-only]
该属性存储轴上的刻度线数量。该值为只读。
visualMax : real [read-only]
坐标轴的视觉最大值。
当轴被平移或缩放时,此属性将保存轴的视觉最大值。默认值为max
visualMin : real [read-only]
轴的视觉最小值。
当轴被平移或缩放时,此属性将保持轴的视觉最小值。默认值为min
zoom : real
坐标轴的缩放值。
缩放值可放大或缩小坐标轴,从而调整图形的大小,同时不会影响网格间隔和标签。默认值为 1。
信号文档
labelFormatChanged(string format)
当坐标轴标签的格式更改为format 时,会发出此信号。
注意: 相应的处理程序 为onLabelFormatChanged 。
[since 6.12] labelPostFormatChanged(string format)
当坐标轴标签的 Post 格式变为format 时,会触发此信号。
注意: 相应的处理程序 为onLabelPostFormatChanged 。
该信号在 Qt 6.12 中引入。
labelPrecisionChanged(int precision)
当坐标轴标签的精度更改为precision 时,会发出此信号。
注意: 相应的处理程序 为onLabelPrecisionChanged 。
maxChanged(real max)
当坐标轴的最大值变为max 时,会发出此信号。
注意: 相应的处理程序 为onMaxChanged 。
minChanged(real min)
当坐标轴的最小值变为min 时,会发出此信号。
注意: 对应的处理程序 为onMinChanged 。
rangeChanged(real min, real max)
当坐标的最小值或最大值分别变为min 和max 时,会触发此信号。
注意: 相应的处理程序 为onRangeChanged 。
subTickCountChanged(int subTickCount)
当轴上的子刻度数量(由subTickCount 指定)发生变化时,会发出此信号。
注意: 相应的处理程序 为onSubTickCountChanged 。
tickCountChanged(int tickCount)
当 tickCount 值变为tickCount 时,将触发此信号。
注意: 相应的处理程序 为onTickCountChanged 。
© 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.