QAbstractSeries 类

The QAbstractSeries class is a base class for all Qt Graphs for 2D series. 更多...

头: #include <QAbstractSeries>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
在 QML: AbstractSeries
继承: QObject and QQmlParserStatus
继承者:

QAreaSeries , QBarSeries , QPieSeries ,和 QXYSeries

公共类型

枚举类 SeriesType { Line, Bar, Scatter, Pie, Spline, Area }

特性

公共函数

virtual ~QAbstractSeries () override
QAbstractAxis * axisX () const
QAbstractAxis * axisY () const
void hide ()
bool isHoverable () const
bool isHovered () const
bool isSelectable () const
bool isVisible () const
const QList<QLegendData> legendData () const
QString name () const
qreal opacity () const
QQmlListProperty<QObject> seriesChildren ()
void setAxisX (QAbstractAxis * newAxisX )
void setAxisY (QAbstractAxis * newAxisY )
void setHoverable (bool newHoverable )
void setName (const QString & name )
void setOpacity (qreal opacity )
void setSelectable (bool selectable )
void setValuesMultiplier (qreal valuesMultiplier )
void setVisible (bool visible = true)
void setZValue (int newDrawOrder )
void show ()
virtual QAbstractSeries::SeriesType type () const = 0
qreal valuesMultiplier () const
int zValue () const

信号

void axisXChanged (QAbstractAxis * newAxis )
void axisYChanged (QAbstractAxis * newAxis )
void hover (const QString & seriesName , QPointF position , QPointF value )
void hoverEnter (const QString & seriesName , QPointF position , QPointF value )
void hoverExit (const QString & seriesName , QPointF position )
void hoverableChanged ()
void hoveredChanged (bool hovered )
void legendDataChanged ()
void nameChanged ()
void opacityChanged ()
void selectableChanged ()
void valuesMultiplierChanged ()
void visibleChanged ()
void zValueChanged (int z )

详细描述

通常,使用继承类的特定于系列类型而不是基类。

另请参阅 QLineSeries , QSplineSeries , QScatterSeries , QBarSeries ,和 QXYSeries .

成员类型文档编制

enum class QAbstractSeries:: SeriesType

此枚举描述系列的类型。

常量 描述
QAbstractSeries::SeriesType::Line 0 A line graph.
QAbstractSeries::SeriesType::Bar 2 A bar graph.
QAbstractSeries::SeriesType::Scatter 4 A scatter graph.
QAbstractSeries::SeriesType::Pie 3 A pie graph.
QAbstractSeries::SeriesType::Spline 5 A spline graph.
QAbstractSeries::SeriesType::Area 1 An area graph.

特性文档编制

[since 6.10] axisX : QAbstractAxis *

X-axis of this series.

The x-axis used for this series. Creates a separate axis from the one defined in GraphsView showing the user multiple axis per graph.

此特性在 Qt 6.10 引入。

访问函数:

QAbstractAxis * axisX () const
void setAxisX (QAbstractAxis * newAxisX )

通知程序信号:

void axisXChanged (QAbstractAxis * newAxis )

[since 6.10] axisY : QAbstractAxis *

Y-axis of this series.

The y-axis used for this series. Creates a separate axis from the one defined in GraphsView showing the user multiple axis per graph.

此特性在 Qt 6.10 引入。

访问函数:

QAbstractAxis * axisY () const
void setAxisY (QAbstractAxis * newAxisY )

通知程序信号:

void axisYChanged (QAbstractAxis * newAxis )

hoverable : bool

Controls if the series is hoverable.

Controls if the series can be hovered with mouse/touch. By default, hoverable 被设为 false .

访问函数:

bool isHoverable () const
void setHoverable (bool newHoverable )

通知程序信号:

void hoverableChanged ()

[read-only] hovered : const bool

Check whether a series is hovered on.

Can be used to check whether mouse/touch is currently hovering on a series.

访问函数:

bool isHovered () const

通知程序信号:

void hoveredChanged (bool hovered )

另请参阅 QAbstractSeries::hovered.

[read-only] legendData : const QList < QLegendData >

Contains information needed to create a legend marker for a data set in a graph.

访问函数:

const QList<QLegendData> legendData () const

通知程序信号:

void legendDataChanged ()

另请参阅 QLegendData .

名称 : QString

This property holds the name of the series.

The name is displayed in the legend for the series and it supports HTML formatting.

访问函数:

QString 名称 () const
void setName (const QString & name )

通知程序信号:

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

访问函数:

qreal opacity () const
void setOpacity (qreal opacity )

通知程序信号:

void opacityChanged ()

selectable : bool

Controls if the series is selectable.

Controls if the series can be selected with mouse/touch. By default, selectable 被设为 false .

访问函数:

bool isSelectable () const
void setSelectable (bool selectable )

通知程序信号:

void selectableChanged ()

[read-only] type : const SeriesType

This property holds the type of the series.

访问函数:

virtual QAbstractSeries::SeriesType type () const = 0

valuesMultiplier : qreal

Controls the series values effective visible value.

This variable can be used for animating the series values so they scale from 0 to actual value size. By default, the valuesMultiplier is 1.0. The valid values range from 0.0 (height 0) to 1.0 (full value).

访问函数:

qreal valuesMultiplier () const
void setValuesMultiplier (qreal valuesMultiplier )

通知程序信号:

void valuesMultiplierChanged ()

visible : bool

Visibility of the series.

The visibility used for this series. By default, visible 被设为 true .

访问函数:

bool isVisible () const
void setVisible (bool visible = true)

通知程序信号:

void visibleChanged ()

[since 6.10] zValue : int

Controls the order in which the series is drawn

The series list of GraphsView is sorted by the zValue property. Since each series type is rendered at once, the order mostly works as an internal order of each series type. The highest zValue of each series type determines the order of rendering among series types. The default value is 0.

此特性在 Qt 6.10 引入。

访问函数:

int zValue () const
void setZValue (int newDrawOrder )

通知程序信号:

void zValueChanged (int z )

成员函数文档编制

[override virtual noexcept] QAbstractSeries:: ~QAbstractSeries ()

Virtual destructor for the graph series.

void QAbstractSeries:: hide ()

Sets the visibility of the series to false .

另请参阅 setVisible () 和 isVisible ().

[signal] void QAbstractSeries:: hover (const QString & seriesName , QPointF position , QPointF value )

This signal is emitted when the series hovering changes. The name of the series is in seriesName , the mouse/touch position in position , and the series value in value .

注意: 此信号才被发射当 hoverable 被设为 true。

注意: For Pie graph, the value represents (angle of position, start angle of hovering slice)

[signal] void QAbstractSeries:: hoverEnter (const QString & seriesName , QPointF position , QPointF value )

This signal is emitted when the series hovering starts. The name of the series is in seriesName , the mouse/touch position in position , and the series value in value .

注意: 此信号才被发射当 hoverable 被设为 true。

注意: For Pie graph, the value represents (angle of position, start angle of hovering slice)

[signal] void QAbstractSeries:: hoverExit (const QString & seriesName , QPointF position )

This signal is emitted when the series hovering ends. The name of the series is in seriesName , and the mouse/touch position in position .

注意: 此信号才被发射当 hoverable 被设为 true。

void QAbstractSeries:: show ()

Sets the visibility of the series to true .

另请参阅 setVisible () 和 isVisible ().