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
实例化: XYSeries
继承: QAbstractSeries
继承者:

QLineSeries and QScatterSeries

状态: 技术预览

特性

公共函数

void append (qreal x , qreal y )
void append (const QPointF & point )
void append (const QList<QPointF> & points )
const QPointF & at (int index ) const
QAbstractAxis * axisX () const
QAbstractAxis * axisY () const
void clear ()
virtual QColor color () const
int count () const
void deselectAllPoints ()
void deselectPoint (int index )
void deselectPoints (const QList<int> & indexes )
void insert (int index , const QPointF & point )
bool isPointSelected (int index )
qreal markerSize () const
QQmlComponent * pointMarker () const
QList<QPointF> points () const
void remove (qreal x , qreal y )
void remove (const QPointF & point )
void remove (int index )
void removePoints (int index , int count )
void replace (qreal oldX , qreal oldY , qreal newX , qreal newY )
void replace (const QPointF & oldPoint , const QPointF & newPoint )
void replace (int index , qreal newX , qreal newY )
void replace (int index , const QPointF & newPoint )
void replace (const QList<QPointF> & points )
void selectAllPoints ()
void selectPoint (int index )
void selectPoints (const QList<int> & indexes )
QColor selectedColor () const
QList<int> selectedPoints () const
void setAxisX (QAbstractAxis * axis )
void setAxisY (QAbstractAxis * axis )
virtual void setColor (const QColor & newColor )
void setMarkerSize (qreal size )
void setPointMarker (QQmlComponent * newPointMarker )
void setPointSelected (int index , bool selected )
void setSelectedColor (const QColor & color )
void toggleSelection (const QList<int> & indexes )

信号

void axisXChanged ()
void axisYChanged ()
void colorChanged (QColor color )
void markerSizeChanged (qreal size )
void pointMarkerChanged ()
void pointReplaced (int index )
void selectedColorChanged (const QColor & color )

详细描述

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

另请参阅 QLineSeries and QScatterSeries .

特性文档编制

axisX : QAbstractAxis *

X-axis of the series.

The x-axis used for the series. This should be QValueAxis .

访问函数:

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

通知程序信号:

void axisXChanged ()

axisY : QAbstractAxis *

Y-axis of the series.

The y-axis used for the series. This should be QValueAxis .

访问函数:

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

通知程序信号:

void axisYChanged ()

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.

访问函数:

virtual QColor color () const
virtual void setColor (const QColor & newColor )

通知程序信号:

void colorChanged (QColor color )

markerSize : qreal

This property holds the size of the point marker in pixels when using a default circle as a marker. When using pointMarker , the size is defined by the pointMarker conponent.

访问函数:

qreal markerSize () const
void setMarkerSize (qreal size )

通知程序信号:

void markerSizeChanged (qreal size )

pointMarker : QQmlComponent *

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

访问函数:

QQmlComponent * pointMarker () const
void setPointMarker (QQmlComponent * newPointMarker )

通知程序信号:

void pointMarkerChanged ()

selectedColor : QColor

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

访问函数:

QColor selectedColor () const
void setSelectedColor (const QColor & color )

通知程序信号:

void selectedColorChanged (const QColor & color )

成员函数文档编制

void QXYSeries:: append ( qreal x , qreal y )

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

void QXYSeries:: append (const QPointF & point )

Appends a point with the coordinates point 到系列。

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

Appends points with the coordinates points 到系列。

const QPointF &QXYSeries:: at ( int index ) const

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

void QXYSeries:: clear ()

从系列删除所有点。

int QXYSeries:: count () const

返回系列中的数据点数。

void QXYSeries:: deselectAllPoints ()

Deselects all points in the series.

注意: Emits QXYSeries::selectedPointsChanged

另请参阅 setPointSelected ().

void QXYSeries:: deselectPoint ( int index )

Deselects point at given index .

注意: Emits QXYSeries::selectedPointsChanged

另请参阅 setPointSelected ().

void QXYSeries:: deselectPoints (const QList < int > & indexes )

Marks multiple points passed in a indexes list as deselected.

注意: Emits QXYSeries::selectedPointsChanged

另请参阅 setPointSelected ().

void QXYSeries:: insert ( int index , const 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.

bool QXYSeries:: isPointSelected ( int index )

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.

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

[signal] void QXYSeries:: pointReplaced ( int 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.

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.

void QXYSeries:: remove (const QPointF & point )

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

void QXYSeries:: remove ( int index )

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

void QXYSeries:: removePoints ( int index , int count )

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

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.

void QXYSeries:: replace (const QPointF & oldPoint , const 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.

void QXYSeries:: replace ( int index , qreal newX , qreal newY )

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

void QXYSeries:: replace ( int index , const QPointF & newPoint )

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

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 pointReplaced when the points have been replaced.

void QXYSeries:: selectAllPoints ()

Marks all points in the series as selected,

注意: Emits QXYSeries::selectedPointsChanged

另请参阅 setPointSelected ().

void QXYSeries:: selectPoint ( int index )

Marks point at index as selected.

注意: Emits QXYSeries::selectedPointsChanged

另请参阅 setPointSelected ().

void QXYSeries:: selectPoints (const QList < int > & indexes )

Marks multiple points passed in a indexes list as selected.

注意: Emits QXYSeries::selectedPointsChanged

另请参阅 setPointSelected ().

QList < int > QXYSeries:: selectedPoints () const

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

另请参阅 setPointSelected ().

void QXYSeries:: setPointSelected ( int 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

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

void QXYSeries:: toggleSelection (const QList < int > & indexes )

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

注意: Emits QXYSeries::selectedPointsChanged

另请参阅 setPointSelected ().