QScatter3DSeries Class

The QScatter3DSeries class represents a data series in a 3D scatter graph. More...

Header: #include <QScatter3DSeries>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
In QML: Scatter3DSeries
Inherits: QAbstract3DSeries

Properties

Public Functions

QScatter3DSeries(QObject *parent = nullptr)
QScatter3DSeries(QScatterDataProxy *dataProxy, QObject *parent = nullptr)
virtual ~QScatter3DSeries() override
void clearArray()
QScatterDataArray dataArray() &&
const QScatterDataArray &dataArray() const &
QScatterDataProxy *dataProxy() const
float itemSize() const
qsizetype selectedItem() const
void setDataArray(const QScatterDataArray &newDataArray)
void setDataProxy(QScatterDataProxy *proxy)
void setItemSize(float size)
void setSelectedItem(qsizetype index)

Signals

void dataArrayChanged(const QScatterDataArray &array)
void dataProxyChanged(QScatterDataProxy *proxy)
void itemSizeChanged(float size)
void selectedItemChanged(qsizetype index)

Static Public Members

qsizetype invalidSelectionIndex()

Detailed Description

This class manages the series-specific visual elements, as well as the series data (via a data proxy).

Regarding the proxy-series relationship, it is crucial to highlight a couple of key points. In this context, data is stored in series and users can access the dataset through the series. This series is controlled or represented by a proxy object. Thus, the proxy can be used to manage various operations on the data and update the actual dataset. However, it is necessary to create a series associated with this proxy to edit the dataset.

If no data proxy is set explicitly for the series, the series creates a default proxy. Setting another proxy will destroy the existing proxy and all data added to the series.

QScatter3DSeries supports the following format tags for QAbstract3DSeries::setItemLabelFormat():

@xTitleTitle from x-axis
@yTitleTitle from y-axis
@zTitleTitle from z-axis
@xLabelItem value formatted using the format of the x-axis. For more information, see QValue3DAxis::labelFormat.
@yLabelItem value formatted using the format of the y-axis. For more information, see QValue3DAxis::labelFormat.
@zLabelItem value formatted using the format of the z-axis. For more information, see QValue3DAxis::labelFormat.
@seriesNameName of the series

For example:

 proxy->setItemLabelFormat(QStringLiteral("@yTitle for (@xLabel, @zLabel): %.1f"));

See also Qt Graphs Data Handling with 3D.

Property Documentation

dataArray : QScatterDataArray

Data array for the series.

Holds the reference to the data array.

dataArrayChanged signal is emitted when data array is set, unless newDataArray is identical to the previous one.

Note: Before doing anything regarding the data array, a series must be created for the relevant proxy.

Access functions:

const QScatterDataArray &dataArray() const &
QScatterDataArray dataArray() &&
void setDataArray(const QScatterDataArray &newDataArray)

Notifier signal:

void dataArrayChanged(const QScatterDataArray &array)

See also clearArray().

dataProxy : QScatterDataProxy*

This property holds the active data proxy.

Sets the active data proxy for the series to proxy. The series assumes ownership of any proxy set to it and deletes any previously set proxy when a new one is added. The proxy argument cannot be null or set to another series.

Access functions:

QScatterDataProxy *dataProxy() const
void setDataProxy(QScatterDataProxy *proxy)

Notifier signal:

void dataProxyChanged(QScatterDataProxy *proxy)

itemSize : float

Item size for the series.

The size must be between 0.0f and 1.0f. Setting the size to 0.0f causes the item size to be automatically scaled based on the total number of items in all the series for the graph.

The preset default is 0.0f.

Access functions:

float itemSize() const
void setItemSize(float size)

Notifier signal:

void itemSizeChanged(float size)

selectedItem : qsizetype

This property holds the item that is selected in the series.

Selects the item at the index index in the data array of the series. Only one item can be selected at a time.

To clear the selection from this series, invalidSelectionIndex() is set as index. If this series is added to a graph, the graph can adjust the selection according to user interaction or if it becomes invalid. Selecting an item on another added series will also clear the selection.

Removing items from or inserting items into the series before the selected item will adjust the selection so that the same item will stay selected.

Access functions:

qsizetype selectedItem() const
void setSelectedItem(qsizetype index)

Notifier signal:

void selectedItemChanged(qsizetype index)

See also Q3DGraphsWidgetItem::clearSelection().

Member Function Documentation

[explicit] QScatter3DSeries::QScatter3DSeries(QObject *parent = nullptr)

Constructs a scatter 3D series with the parent parent.

[explicit] QScatter3DSeries::QScatter3DSeries(QScatterDataProxy *dataProxy, QObject *parent = nullptr)

Constructs a scatter 3D series with the data proxy dataProxy and the parent parent.

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

Deletes the scatter 3D series.

void QScatter3DSeries::clearArray()

Clears the data array.

[static] qsizetype QScatter3DSeries::invalidSelectionIndex()

Returns an invalid index for selection. This index is set to the selectedItem property to clear the selection from this series.

See also Q3DGraphsWidgetItem::clearSelection().