QXYSeries 类

The QXYSeries class is a parent class for all x & y series classes. 更多...

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

QLineSeries , QScatterSeries ,和 QSplineSeries

特性

公共函数

void append (QPointF point )
void append (const QList<QPointF> & points )
void append (qreal x , qreal y )
QPointF at (qsizetype index ) const
void clear ()
QColor color () const
qsizetype count () const
void deselectAllPoints ()
void deselectPoint (qsizetype index )
void deselectPoints (const QList<qsizetype> & indexes )
qsizetype find (QPointF point ) const
void insert (qsizetype index , QPointF point )
bool isDraggable () const
bool isPointSelected (qsizetype index ) const
QQmlComponent * pointDelegate () const
QList<QPointF> points () const
void remove (QPointF point )
void remove (qsizetype index )
void remove (qreal x , qreal y )
void removeMultiple (qsizetype index , qsizetype count )
void replace (const QList<QPointF> & points )
void replace (QPointF oldPoint , QPointF newPoint )
void replace (qsizetype index , QPointF newPoint )
void replace (qsizetype index , qreal newX , qreal newY )
void replace (qreal oldX , qreal oldY , qreal newX , qreal newY )
void selectAllPoints ()
void selectPoint (qsizetype index )
void selectPoints (const QList<qsizetype> & indexes )
QColor selectedColor () const
QList<qsizetype> selectedPoints () const
void setColor (QColor newColor )
void setDraggable (bool newDraggable )
void setPointDelegate (QQmlComponent * newPointDelegate )
void setPointSelected (qsizetype index , bool selected )
void setSelectedColor (QColor color )
bool take (QPointF point )
void toggleSelection (const QList<qsizetype> & indexes )

信号

void colorChanged (QColor color )
void countChanged ()
void draggableChanged ()
void pointDelegateChanged ()
void pointReplaced (qsizetype index )
void pointsReplaced ()
void selectedColorChanged (QColor color )
void selectedPointsChanged ()

详细描述

In QXYSeries, data points are defined as a list of QPointF , defining X and Y positions.

另请参阅 QLineSeries and QScatterSeries .

特性文档编制

color : QColor

This property holds the main color of the series. For QLineSeries this means the line color and for QScatterSeries the color of the point.

访问函数:

QColor color () const
void setColor (QColor newColor )

通知程序信号:

void colorChanged (QColor color )

[read-only] count : const qsizetype

返回系列中的数据点数。

访问函数:

qsizetype count () const

通知程序信号:

void countChanged ()

draggable : bool

Controls if the series is draggable.

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

访问函数:

bool isDraggable () const
void setDraggable (bool newDraggable )

通知程序信号:

void draggableChanged ()

pointDelegate : QQmlComponent *

This property holds a custom QML Component used as a marker for data points.

The dynamic properties available for this component are:

类型 名称 描述
bool pointSelected This value is true when the point is selected, meaning that the point index is in QXYSeries::selectedPoints .
QColor pointColor The color of the series. This value comes either from the QGraphsTheme or from QXYSeries::color QXYSeries overrides the color.
QColor pointBorderColor The border color of the series. This value comes from the QGraphsTheme .
QColor pointSelectedColor The selected color of the series. This value comes either from the QGraphsTheme or from QXYSeries::selectedColor QXYSeries overrides the color.
qreal pointBorderWidth The border width of the series. This value comes from the QGraphsTheme .
qreal pointValueX The value of the QXYPoint::x at this position.
qreal pointValueY The value of the QXYPoint::y at this position.

To use any of these, add property with the defined name into your custom component. For example "property color pointColor" and "property real pointValueX" .

访问函数:

QQmlComponent * pointDelegate () const
void setPointDelegate (QQmlComponent * newPointDelegate )

通知程序信号:

void pointDelegateChanged ()

selectedColor : QColor

This property holds the color of selected points.

访问函数:

QColor selectedColor () const
void setSelectedColor (QColor color )

通知程序信号:

void selectedColorChanged (QColor color )

[read-only] selectedPoints : const QList < qsizetype >

This property holds the indexes of the points which are currently selected.

访问函数:

QList<qsizetype> selectedPoints () const

通知程序信号:

void selectedPointsChanged ()

成员函数文档编制

[invokable] void QXYSeries:: append ( QPointF point )

Appends a point with the coordinates point 到系列。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: append (const QList < QPointF > & points )

Appends points with the coordinates points 到系列。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: append ( qreal x , qreal y )

Appends a point with the coordinates x and y 到系列。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] QPointF QXYSeries:: at ( qsizetype index ) const

Returns the point at the position specified by index . Returns (0, 0) if the index is not valid.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: clear ()

从系列删除所有点。

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: deselectAllPoints ()

Deselects all points in the series.

注意: Emits QXYSeries::selectedPointsChanged

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setPointSelected ().

[invokable] void QXYSeries:: deselectPoint ( qsizetype index )

Deselects point at given index .

注意: Emits QXYSeries::selectedPointsChanged

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setPointSelected ().

[invokable] void QXYSeries:: deselectPoints (const QList < qsizetype > & indexes )

Marks multiple points passed in a indexes list as deselected.

注意: Emits QXYSeries::selectedPointsChanged

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setPointSelected ().

[invokable] qsizetype QXYSeries:: find ( QPointF point ) const

Finds and returns the index of the first matching point found as defined by point . Returns -1 if the point is not found.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: insert ( qsizetype index , QPointF point )

Inserts a point with the coordinates point to the position specified by index in the series. If the index is 0 or less than 0, the point is prepended to the list of points. If the index is equal to or greater than than the number of points in the series, the point is appended to the list of points.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] bool QXYSeries:: isPointSelected ( qsizetype index ) const

Returns true if point at given index is among selected points and false otherwise.

注意: Selected points are drawn using the selected color if it was specified.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 selectedPoints , setPointSelected (),和 setSelectedColor ().

[signal] void QXYSeries:: pointReplaced ( qsizetype index )

This signal is emitted when a point is replaced at the position specified by index .

另请参阅 replace ().

QList < QPointF > QXYSeries:: points () const

Returns the points in the series.

[signal] void QXYSeries:: pointsReplaced ()

This signal is emitted when all points are replaced.

[invokable] void QXYSeries:: remove ( QPointF point )

Removes the point with the coordinates point from the series. Does nothing if the point does not exist.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: remove ( qsizetype index )

Removes the point at the position specified by index from the series.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: remove ( qreal x , qreal y )

Removes the point with the coordinates x and y from the series. Does nothing if the point does not exist.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: removeMultiple ( qsizetype index , qsizetype count )

Removes the number of points specified by count from the series starting at the position specified by index .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: replace (const QList < QPointF > & points )

Replaces the current points with the points specified by points

注意: This is much faster than replacing data points one by one, or first clearing all data, and then appending the new data. Emits pointsReplaced when the points have been replaced.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: replace ( QPointF oldPoint , QPointF newPoint )

Replaces the point with the coordinates oldPoint with the point with the coordinates newPoint . Does nothing if the old point does not exist.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: replace ( qsizetype index , QPointF newPoint )

Replaces the point at the position specified by index with the point that has the coordinates newPoint .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: replace ( qsizetype index , qreal newX , qreal newY )

Replaces the point at the position specified by index with the point that has the coordinates newX and newY .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: replace ( qreal oldX , qreal oldY , qreal newX , qreal newY )

Replaces the point with the coordinates oldX and oldY with the point with the coordinates newX and newY . Does nothing if the old point does not exist.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: selectAllPoints ()

Marks all points in the series as selected,

注意: Emits QXYSeries::selectedPointsChanged

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setPointSelected ().

[invokable] void QXYSeries:: selectPoint ( qsizetype index )

Marks point at index as selected.

注意: Emits QXYSeries::selectedPointsChanged

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setPointSelected ().

[invokable] void QXYSeries:: selectPoints (const QList < qsizetype > & indexes )

Marks multiple points passed in a indexes list as selected.

注意: Emits QXYSeries::selectedPointsChanged

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setPointSelected ().

QList < qsizetype > QXYSeries:: selectedPoints () const

Returns a list of points indexes marked as selected. Selected points are visible regardless of points visibility.

注意: Getter function for property selectedPoints.

另请参阅 setPointSelected ().

[invokable] void QXYSeries:: setPointSelected ( qsizetype index , bool selected )

Marks point at given index as either selected or deselected as specified by selected .

注意: Selected points are drawn using the selected color if it was specified. Emits QXYSeries::selectedPointsChanged

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 isPointSelected (), selectAllPoints (),和 setSelectedColor ().

[invokable] bool QXYSeries:: take ( QPointF point )

Takes a point, specified by point , out of the series if found. Returns true if the operation is successful.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[invokable] void QXYSeries:: toggleSelection (const QList < qsizetype > & indexes )

Changes selection state of points at given indexes to the opposite one.

注意: Emits QXYSeries::selectedPointsChanged

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

另请参阅 setPointSelected ().