QAbstractSeries Class
The QAbstractSeries class is a base class for all Qt Chart series. More...
| Header: | #include <QAbstractSeries> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Graphs) target_link_libraries(mytarget PRIVATE Qt6::Graphs) |
| qmake: | QT += graphs |
| Instantiated By: | AbstractSeries |
| Inherits: | QObject and QQmlParserStatus |
| Inherited By: | |
| Status: | Technical Preview |
- List of all members, including inherited members
- QAbstractSeries is part of Qt Graphs 2D C++ Classes.
Public Types
| enum | SeriesType { SeriesTypeLine, SeriesTypeArea, SeriesTypeBar, SeriesTypeStackedBar, SeriesTypePercentBar, …, SeriesTypeCandlestick } |
Properties
Public Functions
| virtual | ~QAbstractSeries() |
| bool | attachAxis(QAbstractAxis *axis) |
| QList<QAbstractAxis *> | attachedAxes() |
| bool | detachAxis(QAbstractAxis *axis) |
| QGraphsView * | graph() const |
| void | hide() |
| bool | hoverable() const |
| bool | isVisible() const |
| QString | name() const |
| qreal | opacity() const |
| bool | selectable() const |
| QQmlListProperty<QObject> | seriesChildren() |
| void | setHoverable(bool newHoverable) |
| void | setName(const QString &name) |
| void | setOpacity(qreal opacity) |
| void | setSelectable(bool selectable) |
| void | setTheme(SeriesTheme *newTheme) |
| void | setValuesMultiplier(qreal valuesMultiplier) |
| void | setVisible(bool visible = true) |
| void | show() |
| SeriesTheme * | theme() const |
| virtual QAbstractSeries::SeriesType | type() const = 0 |
| qreal | valuesMultiplier() const |
Signals
| void | hoverableChanged() |
| void | nameChanged() |
| void | opacityChanged() |
| void | selectableChanged() |
| void | themeChanged() |
| void | valuesMultiplierChanged() |
| void | visibleChanged() |
Detailed Description
Usually, the series type specific inherited classes are used instead of the base class.
See also QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QBarSeries, QStackedBarSeries, QPercentBarSeries, QHorizontalBarSeries, QHorizontalStackedBarSeries, QHorizontalPercentBarSeries, and QPieSeries.
Member Type Documentation
enum QAbstractSeries::SeriesType
This enum describes the type of the series.
| Constant | Value | Description |
|---|---|---|
QAbstractSeries::SeriesTypeLine | 0 | A line chart. |
QAbstractSeries::SeriesTypeArea | 1 | An area chart. |
QAbstractSeries::SeriesTypeBar | 2 | A vertical bar chart. |
QAbstractSeries::SeriesTypeStackedBar | 3 | A vertical stacked bar chart. |
QAbstractSeries::SeriesTypePercentBar | 4 | A vertical percent bar chart. |
QAbstractSeries::SeriesTypePie | 5 | A pie chart. |
QAbstractSeries::SeriesTypeScatter | 6 | A scatter chart. |
QAbstractSeries::SeriesTypeSpline | 7 | A spline chart. |
QAbstractSeries::SeriesTypeHorizontalBar | 8 | A horizontal bar chart. |
QAbstractSeries::SeriesTypeHorizontalStackedBar | 9 | A horizontal stacked bar chart. |
QAbstractSeries::SeriesTypeHorizontalPercentBar | 10 | A horizontal percent bar chart. |
QAbstractSeries::SeriesTypeBoxPlot | 11 | A box plot chart. |
QAbstractSeries::SeriesTypeCandlestick | 12 | A candlestick chart. |
Property Documentation
name : QString
This property holds the name of the series.
The name is displayed in the legend for the series and it supports HTML formatting.
Access functions:
| QString | name() const |
| void | setName(const QString &name) |
Notifier signal:
| void | nameChanged() |
opacity : qreal
This property holds the opacity of the series.
By default, the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque).
Access functions:
| qreal | opacity() const |
| void | setOpacity(qreal opacity) |
Notifier signal:
| void | opacityChanged() |
[read-only] type : const SeriesType
This property holds the type of the series.
Access functions:
| virtual QAbstractSeries::SeriesType | type() const = 0 |
visible : bool
This property holds whether the series is visible or not.
By default, true.
Access functions:
| bool | isVisible() const |
| void | setVisible(bool visible = true) |
Notifier signal:
| void | visibleChanged() |
Member Function Documentation
[virtual noexcept] QAbstractSeries::~QAbstractSeries()
Virtual destructor for the chart series.
bool QAbstractSeries::attachAxis(QAbstractAxis *axis)
Attaches the axis specified by axis to the series.
Returns true if the axis was attached successfully, false otherwise.
Note: If multiple axes of the same orientation are attached to the same series, they will have the same minimum and maximum values.
See also QGraphsView::addAxis().
QList<QAbstractAxis *> QAbstractSeries::attachedAxes()
Returns the list of axes attached to the series. Usually, an x-axis and a y-axis are attached to a series, except for QPieSeries, which does not have any axes attached.
See also attachAxis() and detachAxis().
bool QAbstractSeries::detachAxis(QAbstractAxis *axis)
Detaches the axis specified by axis from the series.
Returns true if the axis was detached successfully, false otherwise.
See also QGraphsView::removeAxis().
QGraphsView *QAbstractSeries::graph() const
Returns the chart that the series belongs to.
Set automatically when the series is added to the chart, and unset when the series is removed from the chart.
void QAbstractSeries::hide()
Sets the visibility of the series to false.
See also setVisible() and isVisible().
void QAbstractSeries::show()
Sets the visibility of the series to true.
See also setVisible() and isVisible().