CategoryAxis QML Type
CategoryAxis 将命名的范围放置在坐标轴上。更多
Import Statement: | import QtCharts 2.9 |
In C++: | QCategoryAxis |
Inherits: |
属性
- categoriesLabels : StringList
- count : int
- labelsPosition : enumeration
- startValue : int
方法
详细描述
该类型可通过添加标注类别来解释基础数据。类别范围的宽度可以自由指定。
例如
ChartView { title: "Numerical Data for Dummies" anchors.fill: parent legend.visible: false antialiasing: true LineSeries { axisY: CategoryAxis { min: 0 max: 30 CategoryRange { label: "critical" endValue: 2 } CategoryRange { label: "low" endValue: 4 } CategoryRange { label: "normal" endValue: 7 } CategoryRange { label: "high" endValue: 15 } CategoryRange { label: "extremely high" endValue: 30 } } XYPoint { x: 0; y: 4.3 } XYPoint { x: 1; y: 4.1 } XYPoint { x: 2; y: 4.7 } XYPoint { x: 3; y: 3.9 } XYPoint { x: 4; y: 5.2 } } }
属性文档
categoriesLabels : StringList |
作为字符串列表的类别标签。
count : int |
类别数量。
labelsPosition : enumeration |
类别标签的位置。在值上定位时,坐标轴开头和结尾的标签可能会与其他坐标轴的标签重叠。
常数 | 说明 |
---|---|
CategoryAxis.AxisLabelsPositionCenter | 标签以类别为中心。 |
CategoryAxis.AxisLabelsPositionOnValue | 标签定位到类别的上限。 |
startValue : int |
坐标轴上第一个类别的低端。
方法文档
在轴上添加一个新类别,标签为label 。类别标签必须是唯一的。endValue 指定类别的上限。它必须大于前一个类别的上限。否则,该方法将返回,但不会添加新的类别。
remove(string label) |
从坐标轴中删除标签label 指定的类别。
© 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.