QCategoryAxis#

The QCategoryAxis class places named ranges on the axis. More

Synopsis#

Functions#

Signals#

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 :

../../_images/api_category_axis.png
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

parentPySide6.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

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.labelsPositionChanged(position)#
Parameters

positionAxisLabelsPosition

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

positionAxisLabelsPosition

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

setStartValue()