Class QAccelPlot::PlotSeries¶
ClassList > QAccelPlot > PlotSeries
Common QML item contract for data series hosted by PlotView .More...
#include <PlotSeries.hpp>
Inherits the following classes: QQuickItem
Inherited by the following classes: QAccelPlot::BandSeries, QAccelPlot::ColormappedSeries, QAccelPlot::ErrorBarSeries, QAccelPlot::LineCurve, QAccelPlot::RectangleSeries
Inheritance diagram¶
flowchart TB
classQAccelPlot_1_1PlotSeries["QAccelPlot::PlotSeries"]
external_base_classQAccelPlot_1_1PlotSeries_1["QQuickItem"]
external_base_classQAccelPlot_1_1PlotSeries_1 --> classQAccelPlot_1_1PlotSeries
classQAccelPlot_1_1BandSeries["QAccelPlot::BandSeries"]
classQAccelPlot_1_1PlotSeries --> classQAccelPlot_1_1BandSeries
click classQAccelPlot_1_1BandSeries "../classQAccelPlot_1_1BandSeries/" "Open QAccelPlot::BandSeries"
classQAccelPlot_1_1ColormappedSeries["QAccelPlot::ColormappedSeries"]
classQAccelPlot_1_1PlotSeries --> classQAccelPlot_1_1ColormappedSeries
click classQAccelPlot_1_1ColormappedSeries "../classQAccelPlot_1_1ColormappedSeries/" "Open QAccelPlot::ColormappedSeries"
classQAccelPlot_1_1BarSeries["QAccelPlot::BarSeries"]
classQAccelPlot_1_1ColormappedSeries --> classQAccelPlot_1_1BarSeries
click classQAccelPlot_1_1BarSeries "../classQAccelPlot_1_1BarSeries/" "Open QAccelPlot::BarSeries"
classQAccelPlot_1_1HeatmapSeries["QAccelPlot::HeatmapSeries"]
classQAccelPlot_1_1ColormappedSeries --> classQAccelPlot_1_1HeatmapSeries
click classQAccelPlot_1_1HeatmapSeries "../classQAccelPlot_1_1HeatmapSeries/" "Open QAccelPlot::HeatmapSeries"
classQAccelPlot_1_1PointCloud["QAccelPlot::PointCloud"]
classQAccelPlot_1_1ColormappedSeries --> classQAccelPlot_1_1PointCloud
click classQAccelPlot_1_1PointCloud "../classQAccelPlot_1_1PointCloud/" "Open QAccelPlot::PointCloud"
classQAccelPlot_1_1ErrorBarSeries["QAccelPlot::ErrorBarSeries"]
classQAccelPlot_1_1PlotSeries --> classQAccelPlot_1_1ErrorBarSeries
click classQAccelPlot_1_1ErrorBarSeries "../classQAccelPlot_1_1ErrorBarSeries/" "Open QAccelPlot::ErrorBarSeries"
classQAccelPlot_1_1LineCurve["QAccelPlot::LineCurve"]
classQAccelPlot_1_1PlotSeries --> classQAccelPlot_1_1LineCurve
click classQAccelPlot_1_1LineCurve "../classQAccelPlot_1_1LineCurve/" "Open QAccelPlot::LineCurve"
classQAccelPlot_1_1RectangleSeries["QAccelPlot::RectangleSeries"]
classQAccelPlot_1_1PlotSeries --> classQAccelPlot_1_1RectangleSeries
click classQAccelPlot_1_1RectangleSeries "../classQAccelPlot_1_1RectangleSeries/" "Open QAccelPlot::RectangleSeries"
Classes¶
| Type | Name |
|---|---|
| struct | DataBounds Extents of a data update that the caller already knows. |
| struct | DataExtent Extent of the valid coordinates in one dimension. |
Public Types¶
| Type | Name |
|---|---|
| enum | LegendSymbol Supported default legend symbols. |
Public Properties¶
| Type | Name |
|---|---|
| property int | count Read-only: number of records stored, including invalid ones. |
| property quint64 | dataRevision Revision incremented by every accepted change of the series' records. |
| property bool | hoverEnabled Whether the series reacts to the mouse cursor. Default: true . |
| property bool | hovered Read-only: true while the mouse cursor is over the series. |
| property SeriesInspection * | inspection Read-only constant: data queries for this series. |
| property LegendSymbol | legendSymbol Symbol style requested from the default legend. |
| property QString | name Identifying name used by the default legend. |
| property QRectF | plotRect Plot area in parent-item coordinates, assigned by PlotView . |
| property Axis * | xAxis Horizontal axis used for data-to-pixel coordinate mapping. |
| property Axis * | yAxis Vertical axis used for data-to-pixel coordinate mapping. |
Public Signals¶
| Type | Name |
|---|---|
| signal void | countChanged Emitted when the number of records changes. |
| signal void | dataRevisionChanged Emitted when the dataRevision property changes. |
| signal void | hoverEnabledChanged Emitted when the hoverEnabled property changes. |
| signal void | hoveredChanged Emitted when the hovered property changes. |
| signal void | legendEntryChanged Emitted when the result of legendEntry() orlegendEntries() changes. |
| signal void | legendSymbolChanged |
| signal void | nameChanged |
| signal void | plotRectChanged |
| signal void | xAxisChanged |
| signal void | yAxisChanged |
Public Functions¶
| Type | Name |
|---|---|
| PlotSeries (QQuickItem * parent=nullptr) |
|
| virtual void | clearData () Removes all data points from the series. |
| virtual int | count () const Returns the number of records stored. The default is the number of stored data points. |
| quint64 | dataRevision () const Returns the current data revision. |
| bool | hoverEnabled () const Returns whether the series reacts to the mouse cursor. |
| bool | hovered () const Returns whether the mouse cursor is over the series. |
| SeriesInspection * | inspection () const Returns the data queries for this series; created on first use and owned by the series. |
| virtual QList< LegendEntry > | legendEntries () const Returns the legend rows of the series. Default: the legendEntry() , if any. |
| virtual std::optional< LegendEntry > | legendEntry () const Returns how a legend draws the series, or std::nullopt for no legend entry. Default: no entry. |
| LegendSymbol | legendSymbol () const |
| QString | name () const |
| QRectF | plotRect () const |
| void | postData (std::vector< double > && data, int count) Queues a moved double buffer for assignment on the series' thread. |
| void | postData (std::vector< float > && data, int count) Queues a moved float buffer for assignment on the series' thread. |
| void | setData (const double * data, int count) Replaces the series data with count data points copied from an interleaved double array. |
| void | setData (std::vector< double > && data, int count) Replaces the series data by moving an interleaved double buffer. |
| void | setData (const double * data, int count, const DataBounds & bounds) Like setData _(_data _,_count ), with the data extents given as__bounds instead of scanned for. |
| void | setData (std::vector< double > && data, int count, const DataBounds & bounds) Like setData _(_data _,_count ), with the data extents given as__bounds instead of scanned for. |
| void | setDataF (const float * data, int count) Replaces the series data with count data points copied from an interleaved float array. |
| void | setDataF (std::vector< float > && data, int count) Replaces the series data by moving an interleaved float buffer. |
| void | setDataF (const float * data, int count, const DataBounds & bounds) Like setDataF _(_data _,_count ), with the data extents given as__bounds instead of scanned for. |
| void | setDataF (std::vector< float > && data, int count, const DataBounds & bounds) Like setDataF _(_data _,_count ), with the data extents given as__bounds instead of scanned for. |
| void | setHoverEnabled (bool enabled) Sets whether the series reacts to the mouse cursor to enabled . |
| void | setLegendSymbol (LegendSymbol symbol) |
| void | setName (const QString & name) |
| void | setPlotRect (const QRectF & rect) Updates the series geometry to exactly cover rect . |
| void | setXAxis (Axis * axis) |
| void | setYAxis (Axis * axis) |
| Axis * | xAxis () const |
| std::optional< DataExtent > | xDataRange () const Returns the extent this series reports to its horizontal axis, or std::nullopt when it has none. |
| Axis * | yAxis () const |
| std::optional< DataExtent > | yDataRange () const Returns the extent this series reports to its vertical axis, or std::nullopt when it has none. |
| ~PlotSeries () override |
Protected Types¶
| Type | Name |
|---|---|
| enum | CapacityOverflow What a series draws when its records outgrow its GPU capacity. |
| enum | DataChange How the records changed in a data update. |
Protected Attributes¶
| Type | Name |
|---|---|
| bool | overRenderCapacity_ = {false}Whether the record count of the last updateRenderCapacity() exceededrenderCapacity_ . |
| int | renderCapacity_ = {std::numeric\_limits<int>::max()}Records the GPU buffers hold, as of the last updateRenderCapacity() ; the largestint before the first. |
Protected Functions¶
| Type | Name |
|---|---|
| PlotSeries (DataPointStore::Layout layout, DataPointWording wording, QQuickItem * parent) Creates a series whose data points have layout _;_wording names them in warnings. |
|
| void | appendDataPoint (const double * coordinates) Appends one double data point and widens the data ranges by its valid coordinates. |
| virtual void | applyDataPoints (DataPointInput && input) Applies data points passed to setData() orsetDataF() . |
| virtual DataRanges | computeDataRanges () const Scans the records for their extents. The default implementation scans the data points. |
| virtual int | dataPointValueCount () const Returns the number of values per data point that setData() andsetDataF() take. |
| DataPointStore & | dataPoints () Returns the data points of the series. |
| const DataPointStore & | dataPoints () const Returns the data points of the series. |
| bool | event (QEvent * event) override Withholds hover events from a series beneath another series under the cursor. |
| void | extendXDataRange (qreal x) Widens the X extent to include x and notifies the bound axes. |
| void | extendYDataRange (qreal y) Widens the Y extent to include y . A non-finite__y leaves the extent unchanged. |
| virtual bool | inspectionAvailable () const Returns false while the records are ambiguous, such as during a data transition. Default: true. |
| void | inspectionDataChanged (DataChange change=DataChange::Replaced) Advances the data revision and refreshes the data queries. Call after every accepted record change. |
| virtual InspectionDataPoint | inspectionDataPointAt (const QPointF & position) const Returns the record drawn at the series-local position as a data point. Default: unsupported. |
| virtual InspectionRecord | inspectionRecord (int index) const Returns the native record at index for series that are not plain XY series. Default: unsupported. |
| virtual InspectionRecord | inspectionRecordAt (const QPointF & position) const Returns the native record drawn at the series-local position . Default: unsupported. |
| virtual Internal::InspectionSource | inspectionSource () const Returns a view of the XY records that data point queries search. The default has none. |
| void | invalidateDataRanges () Discards the cached extents and notifies the bound axes. |
| void | invalidateInspection () Refreshes the data queries after record validity changed without a data change, such as an axis scale switch. |
| bool | logScaleX () const Returns whether the horizontal axis is logarithmic; false without an axis. |
| bool | logScaleY () const Returns whether the vertical axis is logarithmic; false without an axis. |
| void | notifyDataPointsChanged (DataChange change, int previousCount) Finishes a change of the data points: data ranges, onDataPointsChanged() ,countChanged() , data queries, and a repaint. |
| virtual void | onAxisRangeChanged () Called when the viewport of a bound axis changes. The default implementation schedules a repaint. |
| virtual void | onAxisScaleChanged () Called when a bound axis switches between linear and logarithmic scale, or a different axis is bound. |
| virtual void | onDataPointsChanged (DataChange change, int previousCount) Called after the data points changed, before the data queries are refreshed. The default does nothing. |
| virtual bool | positionInspectionSupported () const Returns whether inspectionDataPointAt() matches records drawn as areas, such as heatmap cells. Default: false. |
| virtual bool | recordInspectionSupported () const Returns whether inspectionRecord() andinspectionRecordAt() answer for this series. Default: false. |
| QRectF | resolvePlotRect () const Returns the plot area to render into: plotRect when set, otherwise the item's current size. |
| void | setHovered (bool hovered) Sets the hovered property to hovered . Called by the hover handling of a series. |
| void | storeDataPoints (DataPointInput && input) Stores input as the data points and finishes the change. |
| void | supportHover () Makes the series accept hover events while hoverEnabled istrue . |
| void | updateRenderCapacity (int capacity, int recordCount, CapacityOverflow overflow=CapacityOverflow::DropsExcess) Stores capacity , the number of records the GPU buffers hold, and warns when__recordCount newly exceeds it. |
| bool | validateDataSize (std::size_t valueCount, int count, bool floatData, int valuesPerDataPoint=0) const Returns whether valueCount values hold__count data points; warns otherwise. |
| bool | validateRawDataArguments (const void * data, int count) const Returns whether data and__count are valid arguments for copying data points; warns otherwise. |
Detailed Description¶
PlotSeries owns the integration shared by every plot type: axis bindings, plot-area layout, data-range reporting, legend metadata, and a common C++ data-setting API backed by the series' data points. Concrete series define their data point layout, rendering, and hit testing.
setData(), setDataF(), and postData() take interleaved values, one data point after another, in the layout of the series:
| Series | Data point | Values |
|---|---|---|
LineCurve |
(x, y) | 2 |
PointCloud |
(x, y) | 2 |
RectangleSeries |
(x1, y1, x2, y2) | 4 |
BarSeries |
(position, value) | 2 |
BandSeries |
(x, low, high) | 3 |
ErrorBarSeries |
(x, y, low, high) | 4 |
HeatmapSeries |
cell value | 1 |
The buffer holds count times that many values. A HeatmapSeries takes its cells row by row, columns per row. Series-specific setters take other layouts, such as point values, categories, or ranged bars.
Series smooth their edges with the inherited antialiasing property. HeatmapSeries ignores it.
| Series | Default antialiasing |
Smoothed edges |
|---|---|---|
LineCurve |
true |
lines and markers |
PointCloud |
true |
markers |
BandSeries |
true |
edge lines |
ErrorBarSeries |
true |
lines and caps |
RectangleSeries |
false |
rectangles and their border |
BarSeries |
false |
bars and their border |
See also: LineCurve, PointCloud, RectangleSeries, BarSeries, BandSeries, ErrorBarSeries, HeatmapSeries, QAccelPlot
Public Types Documentation¶
enum LegendSymbol¶
Supported default legend symbols.
Line draws the series line style and marker, Fill a filled swatch, and Marker only the series marker shape (used by unconnected series such as PointCloud).
Public Properties Documentation¶
property count¶
Read-only: number of records stored, including invalid ones.
A record is one data point of the layout in the class description: a point of a LineCurve or PointCloud, a rectangle, a bar, a band sample, an error bar, or a heatmap cell. A HeatmapSeries counts columns × rows cells, without an incomplete last row.
property dataRevision¶
Revision incremented by every accepted change of the series' records.
property hoverEnabled¶
Whether the series reacts to the mouse cursor. Default: true .
When false, the series is never hovered and hover reaches the series beneath it. QACCELPLOT_HOVER_ENABLED=0 turns hover off for every series regardless of this property. HeatmapSeries has no hover and ignores it.
property hovered¶
Read-only: true while the mouse cursor is over the series.
Only the topmost series under the cursor is hovered. A series with a hoveredIndex is hovered while that index is not -1. A HeatmapSeries is never hovered.
property inspection¶
Read-only constant: data queries for this series.
property legendSymbol¶
Symbol style requested from the default legend.
property name¶
Identifying name used by the default legend.
property plotRect¶
Plot area in parent-item coordinates, assigned by PlotView .
property xAxis¶
Horizontal axis used for data-to-pixel coordinate mapping.
property yAxis¶
Vertical axis used for data-to-pixel coordinate mapping.
Public Signals Documentation¶
signal countChanged¶
Emitted when the number of records changes.
signal dataRevisionChanged¶
Emitted when the dataRevision property changes.
signal hoverEnabledChanged¶
Emitted when the hoverEnabled property changes.
signal hoveredChanged¶
Emitted when the hovered property changes.
signal legendEntryChanged¶
Emitted when the result of legendEntry() orlegendEntries() changes.
signal legendSymbolChanged¶
signal nameChanged¶
signal plotRectChanged¶
signal xAxisChanged¶
signal yAxisChanged¶
Public Functions Documentation¶
function PlotSeries¶
function clearData¶
Removes all data points from the series.
function count¶
Returns the number of records stored. The default is the number of stored data points.
function dataRevision¶
Returns the current data revision.
function hoverEnabled¶
Returns whether the series reacts to the mouse cursor.
function hovered¶
Returns whether the mouse cursor is over the series.
function inspection¶
Returns the data queries for this series; created on first use and owned by the series.
function legendEntries¶
Returns the legend rows of the series. Default: the legendEntry() , if any.
A series colored by category returns one entry per category, labeled by its name. Series that override it emit legendEntryChanged() whenever the result changes.
function legendEntry¶
Returns how a legend draws the series, or std::nullopt for no legend entry. Default: no entry.
Series that override it emit legendEntryChanged() whenever the result changes.
function legendSymbol¶
function name¶
function plotRect¶
function postData¶
Queues a moved double buffer for assignment on the series' thread.
function postData¶
Queues a moved float buffer for assignment on the series' thread.
function setData¶
Replaces the series data with count data points copied from an interleaved double array.
See the class description for the data point layout of each series.
function setData¶
Replaces the series data by moving an interleaved double buffer.
function setData¶
Like setData _(_data _,_count ), with the data extents given as__bounds instead of scanned for.
function setData¶
Like setData _(_data _,_count ), with the data extents given as__bounds instead of scanned for.
void QAccelPlot::PlotSeries::setData (
std::vector< double > && data,
int count,
const DataBounds & bounds
)
function setDataF¶
Replaces the series data with count data points copied from an interleaved float array.
function setDataF¶
Replaces the series data by moving an interleaved float buffer.
function setDataF¶
Like setDataF _(_data _,_count ), with the data extents given as__bounds instead of scanned for.
function setDataF¶
Like setDataF _(_data _,_count ), with the data extents given as__bounds instead of scanned for.
void QAccelPlot::PlotSeries::setDataF (
std::vector< float > && data,
int count,
const DataBounds & bounds
)
function setHoverEnabled¶
Sets whether the series reacts to the mouse cursor to enabled .
Turning hover off while the series is hovered clears its hover state at once.
function setLegendSymbol¶
function setName¶
function setPlotRect¶
Updates the series geometry to exactly cover rect .
function setXAxis¶
function setYAxis¶
function xAxis¶
function xDataRange¶
Returns the extent this series reports to its horizontal axis, or std::nullopt when it has none.
The first read after a data update scans the records, unless the update came with DataBounds.
function yAxis¶
function yDataRange¶
Returns the extent this series reports to its vertical axis, or std::nullopt when it has none.
function ~PlotSeries¶
Protected Types Documentation¶
enum CapacityOverflow¶
What a series draws when its records outgrow its GPU capacity.
enum DataChange¶
How the records changed in a data update.
Protected Attributes Documentation¶
variable overRenderCapacity_¶
Whether the record count of the last updateRenderCapacity() exceededrenderCapacity_ .
variable renderCapacity_¶
Records the GPU buffers hold, as of the last updateRenderCapacity() ; the largestint before the first.
Protected Functions Documentation¶
function PlotSeries¶
Creates a series whose data points have layout _;_wording names them in warnings.
QAccelPlot::PlotSeries::PlotSeries (
DataPointStore::Layout layout,
DataPointWording wording,
QQuickItem * parent
)
function appendDataPoint¶
Appends one double data point and widens the data ranges by its valid coordinates.
function applyDataPoints¶
Applies data points passed to setData() orsetDataF() .
The default stores them; series that animate data changes override it.
function computeDataRanges¶
Scans the records for their extents. The default implementation scans the data points.
Called when a data range is read after invalidateDataRanges(), so a series that nothing asks for its range never scans.
function dataPointValueCount¶
Returns the number of values per data point that setData() andsetDataF() take.
The default is one per coordinate column.
function dataPoints¶
Returns the data points of the series.
function dataPoints¶
Returns the data points of the series.
function event¶
Withholds hover events from a series beneath another series under the cursor.
Series ignore hover events so that the plot receives them too. Qt Quick 6.3 and newer stop at the topmost hovered item anyway; older versions also deliver the event to the series beneath, which then see a hover leave instead.
function extendXDataRange¶
Widens the X extent to include x and notifies the bound axes.
Lets an append-style ingestion path keep computed extents current in O(1) instead of rescanning the whole buffer. A non-finite x leaves the extent unchanged.
function extendYDataRange¶
Widens the Y extent to include y . A non-finite__y leaves the extent unchanged.
function inspectionAvailable¶
Returns false while the records are ambiguous, such as during a data transition. Default: true.
function inspectionDataChanged¶
Advances the data revision and refreshes the data queries. Call after every accepted record change.
function inspectionDataPointAt¶
Returns the record drawn at the series-local position as a data point. Default: unsupported.
virtual InspectionDataPoint QAccelPlot::PlotSeries::inspectionDataPointAt (
const QPointF & position
) const
function inspectionRecord¶
Returns the native record at index for series that are not plain XY series. Default: unsupported.
function inspectionRecordAt¶
Returns the native record drawn at the series-local position . Default: unsupported.
virtual InspectionRecord QAccelPlot::PlotSeries::inspectionRecordAt (
const QPointF & position
) const
function inspectionSource¶
Returns a view of the XY records that data point queries search. The default has none.
function invalidateDataRanges¶
Discards the cached extents and notifies the bound axes.
Call after every change of the records, or of anything else computeDataRanges() depends on.
function invalidateInspection¶
Refreshes the data queries after record validity changed without a data change, such as an axis scale switch.
function logScaleX¶
Returns whether the horizontal axis is logarithmic; false without an axis.
function logScaleY¶
Returns whether the vertical axis is logarithmic; false without an axis.
function notifyDataPointsChanged¶
Finishes a change of the data points: data ranges, onDataPointsChanged() ,countChanged() , data queries, and a repaint.
function onAxisRangeChanged¶
Called when the viewport of a bound axis changes. The default implementation schedules a repaint.
function onAxisScaleChanged¶
Called when a bound axis switches between linear and logarithmic scale, or a different axis is bound.
Log scale changes which data points are valid. The data ranges of a changed scale are already invalidated; series override this to refresh cached geometry. The default implementation does nothing.
function onDataPointsChanged¶
Called after the data points changed, before the data queries are refreshed. The default does nothing.
function positionInspectionSupported¶
Returns whether inspectionDataPointAt() matches records drawn as areas, such as heatmap cells. Default: false.
function recordInspectionSupported¶
Returns whether inspectionRecord() andinspectionRecordAt() answer for this series. Default: false.
function resolvePlotRect¶
Returns the plot area to render into: plotRect when set, otherwise the item's current size.
Safe to call from updatePaintNode(); it never modifies the item.
function setHovered¶
Sets the hovered property to hovered . Called by the hover handling of a series.
function storeDataPoints¶
Stores input as the data points and finishes the change.
function supportHover¶
Makes the series accept hover events while hoverEnabled istrue .
Call from the constructor of a series that reacts to the cursor. Its hoverLeaveEvent() must clear the hover state, hovered included, as turning hoverEnabled off calls it.
function updateRenderCapacity¶
Stores capacity , the number of records the GPU buffers hold, and warns when__recordCount newly exceeds it.
void QAccelPlot::PlotSeries::updateRenderCapacity (
int capacity,
int recordCount,
CapacityOverflow overflow=CapacityOverflow::DropsExcess
)
Call from updatePaintNode() on every frame. A series that stays over capacity, for example while streaming, warns once; one whose data fits again and then outgrows the capacity warns again. overflow says in the warning what the series draws.
function validateDataSize¶
Returns whether valueCount values hold__count data points; warns otherwise.
bool QAccelPlot::PlotSeries::validateDataSize (
std::size_t valueCount,
int count,
bool floatData,
int valuesPerDataPoint=0
) const
A data point has valuesPerDataPoint values, or one per coordinate column when it is 0.
function validateRawDataArguments¶
Returns whether data and__count are valid arguments for copying data points; warns otherwise.
The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/series/PlotSeries.hpp