QBarCategoryAxis

The QBarCategoryAxis class adds categories to a chart’s axes. More

Inheritance diagram of PySide6.QtCharts.QBarCategoryAxis

Synopsis

Functions

Signals

Detailed Description

QBarCategoryAxis can be set up to show an axis line with tick marks, grid lines, and shades. Categories are drawn between the ticks. It can be used also with a line series, as demonstrated by the Line and BarChart Example .

The following code illustrates how to use QBarCategoryAxis :

QChartView *chartView = new QChartView;
QBarSeries *series = new QBarSeries;
// ...
chartView->chart()->addSeries(series);
chartView->chart()->createDefaultAxes();

QBarCategoryAxis *axisX = new QBarCategoryAxis;
QStringList categories;
categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
axisX->append(categories);
axisX->setRange("Feb", "May");
chartView->chart()->setAxisX(axisX, series);
class PySide6.QtCharts.QBarCategoryAxis([parent=None])
Parameters

parentPySide6.QtCore.QObject

Constructs an axis object that is the child of parent.

PySide6.QtCharts.QBarCategoryAxis.append(categories)
Parameters

categories – list of strings

Appends categories to an axis. The maximum value on the axis will be changed to match the last category in categories. If no categories were previously defined, the minimum value on the axis will also be changed to match the first category in categories.

A category has to be a valid QString and it cannot be duplicated. Duplicated categories will not be appended.

PySide6.QtCharts.QBarCategoryAxis.append(category)
Parameters

category – str

Appends category to an axis. The maximum value on the axis will be changed to match the last category. If no categories were previously defined, the minimum value on the axis will also be changed to match category.

A category has to be a valid QString and it cannot be duplicated. Duplicated categories will not be appended.

PySide6.QtCharts.QBarCategoryAxis.at(index)
Parameters

index – int

Return type

str

Returns the category at index. The index must be valid.

PySide6.QtCharts.QBarCategoryAxis.categories()
Return type

list of strings

This property holds The categories of an axis..

PySide6.QtCharts.QBarCategoryAxis.categoriesChanged()
PySide6.QtCharts.QBarCategoryAxis.clear()

Removes all categories. Sets the maximum and minimum values of the axis range to QString::null.

PySide6.QtCharts.QBarCategoryAxis.count()
Return type

int

This property holds The number of categories of an axis..

PySide6.QtCharts.QBarCategoryAxis.countChanged()
PySide6.QtCharts.QBarCategoryAxis.insert(index, category)
Parameters
  • index – int

  • category – str

Inserts category to the axis at index. category has to be a valid QString and it cannot be duplicated. If category is prepended or appended to other categories, the minimum and maximum values on the axis are updated accordingly.

PySide6.QtCharts.QBarCategoryAxis.max()
Return type

str

This property holds The maximum value on the axis..

PySide6.QtCharts.QBarCategoryAxis.maxChanged(max)
Parameters

max – str

PySide6.QtCharts.QBarCategoryAxis.min()
Return type

str

This property holds The minimum value on the axis..

PySide6.QtCharts.QBarCategoryAxis.minChanged(min)
Parameters

min – str

PySide6.QtCharts.QBarCategoryAxis.rangeChanged(min, max)
Parameters
  • min – str

  • max – str

PySide6.QtCharts.QBarCategoryAxis.remove(category)
Parameters

category – str

Removes category from the axis. Removing a category that currently sets the maximum or minimum value on the axis will affect the axis range.

PySide6.QtCharts.QBarCategoryAxis.replace(oldCategory, newCategory)
Parameters
  • oldCategory – str

  • newCategory – str

Replaces oldCategory with newCategory. If oldCategory does not exist on the axis, nothing is done. newCategory has to be a valid QString and it cannot be duplicated. If the minimum or maximum category is replaced, the minimum and maximum values on the axis are updated accordingly.

PySide6.QtCharts.QBarCategoryAxis.setCategories(categories)
Parameters

categories – list of strings

This property holds The categories of an axis..

PySide6.QtCharts.QBarCategoryAxis.setMax(maxCategory)
Parameters

maxCategory – str

This property holds The maximum value on the axis..

PySide6.QtCharts.QBarCategoryAxis.setMin(minCategory)
Parameters

minCategory – str

This property holds The minimum value on the axis..

PySide6.QtCharts.QBarCategoryAxis.setRange(minCategory, maxCategory)
Parameters
  • minCategory – str

  • maxCategory – str

Sets the axis range from minCategory to maxCategory.