QCategoryAxis¶
The QCategoryAxis
class places named ranges on the axis. More…
Synopsis¶
Functions¶
def
append
(label, categoryEndValue)def
categoriesLabels
()def
count
()def
endValue
(categoryLabel)def
labelsPosition
()def
remove
(label)def
replaceLabel
(oldLabel, newLabel)def
setLabelsPosition
(position)def
setStartValue
(min)def
startValue
([categoryLabel=””])
Signals¶
def
categoriesChanged
()def
labelsPositionChanged
(position)
Detailed Description¶
This class can be used to explain the underlying data by adding labeled categories. Unlike QBarCategoryAxis
, QCategoryAxis
allows the widths of the category ranges to be specified freely.
Example code on how to use QCategoryAxis
:
QChartView *chartView = new QChartView; QLineSeries *series = new QLineSeries; // ... chartView->chart()->addSeries(series); QCategoryAxis *axisY = new QCategoryAxis; axisY->setMin(0); axisY->setMax(52); axisY->setStartValue(15); axisY->append("First", 20); axisY->append("Second", 37); axisY->append("Third", 52); chartView->chart()->setAxisY(axisY, series);
- class PySide6.QtCharts.QCategoryAxis([parent=None])¶
- Parameters
parent –
PySide6.QtCore.QObject
Constructs an axis object that is a child of parent
.
- PySide6.QtCharts.QCategoryAxis.AxisLabelsPosition¶
This enum describes the position of the category labels.
Constant
Description
QCategoryAxis.AxisLabelsPositionCenter
Labels are centered to category.
QCategoryAxis.AxisLabelsPositionOnValue
Labels are positioned to the high end limit of the category.
- PySide6.QtCharts.QCategoryAxis.append(label, categoryEndValue)¶
- Parameters
label – str
categoryEndValue – float
Appends a new category to the axis with the label categoryLabel
. A category label has to be unique. categoryEndValue
specifies the high end limit of the category. It has to be greater than the high end limit of the previous category. Otherwise the method returns without adding a new category.
- PySide6.QtCharts.QCategoryAxis.categoriesChanged()¶
- PySide6.QtCharts.QCategoryAxis.categoriesLabels()¶
- Return type
list of strings
This property holds The category labels as a string list..
- PySide6.QtCharts.QCategoryAxis.count()¶
- Return type
int
This property holds The number of categories..
- PySide6.QtCharts.QCategoryAxis.endValue(categoryLabel)¶
- Parameters
categoryLabel – str
- Return type
float
Returns the high end limit of the category specified by categoryLabel
.
- PySide6.QtCharts.QCategoryAxis.labelsPosition()¶
- Return type
This property holds The position of the category labels. The labels in the beginning and in the end of the axes may overlap other axes’ labels when positioned on value..
- PySide6.QtCharts.QCategoryAxis.labelsPositionChanged(position)¶
- Parameters
position –
AxisLabelsPosition
- PySide6.QtCharts.QCategoryAxis.remove(label)¶
- Parameters
label – str
Removes a category specified by the label categoryLabel
from the axis.
- PySide6.QtCharts.QCategoryAxis.replaceLabel(oldLabel, newLabel)¶
- Parameters
oldLabel – str
newLabel – str
Replaces an existing category label specified by oldLabel
with newLabel
. If the old label does not exist, the method returns without making any changes.
- PySide6.QtCharts.QCategoryAxis.setLabelsPosition(position)¶
- Parameters
position –
AxisLabelsPosition
This property holds The position of the category labels. The labels in the beginning and in the end of the axes may overlap other axes’ labels when positioned on value..
- PySide6.QtCharts.QCategoryAxis.setStartValue(min)¶
- Parameters
min – float
This property holds The low end of the first category on the axis..
- PySide6.QtCharts.QCategoryAxis.startValue([categoryLabel=""])¶
- Parameters
categoryLabel – str
- Return type
float
Returns the low end limit of the category specified by categoryLabel
.
See also
© 2022 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.