ValueAxis QML Type
为图表的坐标轴添加值。更多
Import Statement: | import QtCharts 2.9 |
In C++: | QValueAxis |
Inherits: |
属性
- labelFormat : string
- max : real
- min : real
- minorTickCount : int
- tickAnchor : real
(since QtCharts 2.3)
- tickCount : int
- tickInterval : real
(since QtCharts 2.3)
- tickType : enumeration
(since QtCharts 2.3)
信号
- rangeChanged(string min, string max)
方法
详细说明
ValueAxis 类型可设置为显示带有刻度线、网格线和阴影的轴线。坐标轴上的值绘制在刻度线的位置上。
以下示例代码说明了如何使用 ValueAxis 类型:
属性文档
labelFormat : string |
格式字符串支持printf()
在标准 C++ 库中提供的以下转换指定符、长度修饰符和标志:d、i、o、x、X、f、F、e、E、g、G、c。
如果ChartView.localizeNumbers 是true
,支持的指定符仅限于:d、e、E、f、g、G 和 i。此外,只支持精度修饰符。其余格式来自应用程序的默认QLocale 。
另请参见 QString::asprintf()。
max : real |
轴上的最大值。
设置此属性时,必要时会调整最小值,以确保范围保持有效。
min : real |
轴上的最小值。
设置此属性时,必要时会调整最大值,以确保范围保持有效。
minorTickCount : int |
坐标轴上的小刻度线数量。这表示在图表的主要刻度线之间绘制多少条网格线。小刻度线不绘制标签。默认值为 0。
tickAnchor : real |
动态放置刻度线和标签的基准值。
该属性在 QtCharts 2.3 中引入。
tickCount : int |
轴上刻度线的数量。这表示在图表上绘制了多少条网格线。默认值为 5,且不能少于 2。
tickInterval : real |
动态放置的刻度线和标签之间的间隔。
该属性在 QtCharts 2.3 中引入。
tickType : enumeration |
刻度线和标签的定位方法。
常数 | 说明 |
---|---|
ValueAxis.TicksDynamic | 根据tickAnchor 和tickInterval 值放置刻度线。 |
ValueAxis.TicksFixed | 刻度线在坐标轴范围内均匀分布。tickCount 值指定刻度线的数量。 |
该属性在 QtCharts 2.3 中引入。
信号文档
当min 或max 轴的值发生变化时,将发出该信号。
相应的信号处理程序是onRangeChanged
。
注: 相应的处理程序是onRangeChanged
。
方法文档
applyNiceNumbers() |
修改坐标轴上的当前刻度范围和刻度线数量,使其看起来更美观。该算法认为可表示为 1*10^n、2*10^n 或 5*10^n 形式的数字是漂亮的数字。这些数字用于设置刻度线的间距。
© 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.