- class QCategoryAxis#
The
QCategoryAxis
class places named ranges on the axis. More…Synopsis#
Properties#
categoriesLabelsᅟ
- Category labels as a string listcountᅟ
- Number of categorieslabelsPositionᅟ
- 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 valuestartValueᅟ
- Low end of the first category on the axis
Methods#
def
__init__()
def
append()
def
count()
def
endValue()
def
labelsPosition()
def
remove()
def
replaceLabel()
def
setStartValue()
def
startValue()
Signals#
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
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 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.
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property categoriesLabelsᅟ: list of strings#
This property holds The category labels as a string list..
- Access functions:
- property countᅟ: int#
This property holds The number of categories..
- Access functions:
- property labelsPositionᅟ: QCategoryAxis.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..
- Access functions:
- property startValueᅟ: float#
This property holds The low end of the first category on the axis..
- Access functions:
Constructs an axis object that is a child of
parent
.- 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.- categoriesChanged()#
This signal is emitted when the categories of the axis change.
- categoriesLabels()#
- Return type:
list of strings
Returns the list of the categories’ labels.
Getter of property
categoriesLabelsᅟ
.- count()#
- Return type:
int
Returns the number of categories.
Getter of property
countᅟ
.- endValue(categoryLabel)#
- Parameters:
categoryLabel – str
- Return type:
float
Returns the high end limit of the category specified by
categoryLabel
.- labelsPosition()#
- Return type:
See also
Getter of property
labelsPositionᅟ
.- labelsPositionChanged(position)#
- Parameters:
position –
AxisLabelsPosition
Notification signal of property
labelsPositionᅟ
.- remove(label)#
- Parameters:
label – str
Removes a category specified by the label
categoryLabel
from the axis.- replaceLabel(oldLabel, newLabel)#
- Parameters:
oldLabel – str
newLabel – str
Replaces an existing category label specified by
oldLabel
withnewLabel
. If the old label does not exist, the method returns without making any changes.- setLabelsPosition(position)#
- Parameters:
position –
AxisLabelsPosition
See also
Setter of property
labelsPositionᅟ
.- setStartValue(min)#
- Parameters:
min – float
Sets
min
to be the low end limit of the first category on the axis. If categories have already been added to the axis, the passed value must be less than the high end value of the already defined first category range. Otherwise nothing is done.See also
Setter of property
startValueᅟ
.- startValue([categoryLabel=""])#
- Parameters:
categoryLabel – str
- Return type:
float
Returns the low end limit of the category specified by
categoryLabel
.See also