Class QAccelPlot::LineCurve¶
ClassList > QAccelPlot > LineCurve
A hardware-accelerated QML item that renders a 2D line curve with optional markers, dashing, and gradient effects. More...
#include <LineCurve.hpp>
Inherits the following classes: QAccelPlot::PlotSeries
Inheritance diagram¶
flowchart TB
classQAccelPlot_1_1LineCurve["QAccelPlot::LineCurve"]
classQAccelPlot_1_1PlotSeries["QAccelPlot::PlotSeries"]
classQAccelPlot_1_1PlotSeries --> classQAccelPlot_1_1LineCurve
click classQAccelPlot_1_1PlotSeries "../classQAccelPlot_1_1PlotSeries/" "Open QAccelPlot::PlotSeries"
external_base_classQAccelPlot_1_1PlotSeries_1["QQuickItem"]
external_base_classQAccelPlot_1_1PlotSeries_1 --> classQAccelPlot_1_1PlotSeries
Public Types inherited from QAccelPlot::PlotSeries¶
| Type | Name |
|---|---|
| enum | LegendSymbol Supported default legend symbols. |
Public Properties¶
| Type | Name |
|---|---|
| property qreal | antialiasingFeather Antialiasing feather width in pixels, clamped to [0, 10]. Has effect only when the inherited antialiasing istrue . Default: 1. |
| property QColor | color Base line color. Default: Colors.dark.seriesPrimary . |
| property QQmlListProperty< LineCurveEffect > | effects List of visual effects (e.g. GradientFill ,GradientStroke ) applied to this curve. |
| property LineCurveGaps * | gaps Grouped gap-rendering settings, e.g. gaps.nanMode . |
| property qreal | hoverRadius Pick distance in pixels from the line; 0 disables line hover. Markers are picked within their size. Default: 10. |
| property LineStyle * | lineStyle Line style ( SolidLine ,DashLine , orNoLine ). Default:SolidLine . |
| property qreal | lineWidth Line stroke width in pixels. Default: 1. |
| property SeriesMarker * | marker Grouped marker settings, e.g. marker.shape andmarker.size . |
| property StepMode | stepMode How the line joins consecutive data points. Default: StepMode.None . |
| property DataTransition * | transition Optional data transition animation applied when new data arrives. |
Public Properties inherited from QAccelPlot::PlotSeries¶
| 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 | antialiasingFeatherChanged Emitted when the antialiasingFeather property changes. |
| signal void | colorChanged Emitted when the color property changes. |
| signal void | hoverRadiusChanged Emitted when the hoverRadius property changes. |
| signal void | lineStyleChanged Emitted when the lineStyle property changes. |
| signal void | lineWidthChanged Emitted when the lineWidth property changes. |
| signal void | stepModeChanged Emitted when the stepMode property changes. |
| signal void | transitionChanged Emitted when the transition property changes. |
Public Signals inherited from QAccelPlot::PlotSeries¶
| 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 |
|---|---|
| LineCurve (QQuickItem * parent=nullptr) Constructs a LineCurve with the given__parent . |
|
| qreal | antialiasingFeather () const Returns the antialiasing feather width in pixels. |
| Q_INVOKABLE void | appendData (qreal x, qreal y) Appends a single data point ( x _,_y ) to the curve. Triggers a redraw. |
| virtual Q_INVOKABLE void | clearData () override Removes all data points from the curve. |
| QColor | color () const Returns the base line color. |
| QQmlListProperty< LineCurveEffect > | effects () Returns the QML list property for attached visual effects. |
| LineCurveGaps * | gaps () const Returns the grouped gap-rendering settings. The object is owned by the curve. |
| qreal | hoverRadius () const Returns the hover pick distance from the line in pixels. |
| virtual std::optional< LegendEntry > | legendEntry () override const Returns the legend entry: the symbol, color, line, and marker of the curve. |
| LineStyle * | lineStyle () const Returns the active line style. |
| qreal | lineWidth () const Returns the line stroke width. |
| SeriesMarker * | marker () const Returns the grouped marker settings. The object is owned by the curve. |
| 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 | setAntialiasingFeather (qreal feather) Sets the antialiasing feather width to feather pixels, clamped to [0, 10]. |
| void | setColor (const QColor & c) Sets the line color to c . |
| Q_INVOKABLE void | setData (const QList< QPointF > & data) Replaces the curve data with data (a list of QPointF values). |
| void | setData (const std::vector< double > & xs, const std::vector< double > & ys) Sets data from separate X and Y vectors. If sizes don't match, the shorter length is used. |
| 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 | setHoverRadius (qreal radius) Sets the hover pick distance from the line to radius pixels. Negative values are clamped to 0. Marker hit testing is unaffected. |
| void | setLineStyle (LineStyle * style) Sets the line style to style . |
| void | setLineWidth (qreal w) Sets the line stroke width to w pixels. |
| void | setStepMode (StepMode mode) Sets how the line joins consecutive data points to mode . |
| void | setTransition (DataTransition * transition) Sets the data transition to transition . |
| StepMode | stepMode () const Returns how the line joins consecutive data points. |
| DataTransition * | transition () const Returns the active data transition, or nullptr if none. |
| ~LineCurve () override Destroys the curve, ending its animation on the assigned transition. |
Public Functions inherited from QAccelPlot::PlotSeries¶
| 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 inherited from QAccelPlot::PlotSeries¶
| 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 inherited from QAccelPlot::PlotSeries¶
| 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 |
|---|---|
| virtual void | applyDataPoints (DataPointInput && input) override Applies new points, animating to them when a transition is enabled. |
| bool | contains (const QPointF & point) override const Returns true if__point lies within the curve's hit-test region. |
| virtual void | onAxisScaleChanged () override Refreshes cached geometry when a bound axis changes between linear and log scale. |
| virtual void | onDataPointsChanged (DataChange change, int previousCount) override Refreshes the vertex cache and the hit-test chunks after the points changed. |
Protected Functions inherited from QAccelPlot::PlotSeries¶
| 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¶
The setData() overloads retain double-precision coordinates, including large timestamp values. Methods whose names end in F store interleaved float XY pairs [x0, y0, x1, y1, …]. For maximum throughput prefer setDataF(std::vector<float>&&, int) or postData(std::vector<float>&&, int), which move an already-interleaved float buffer with zero allocation and no type conversion. postData(std::vector<double>&&, int) hands off a double-precision buffer from a worker thread instead. The curve is rendered on the Qt Scene Graph render thread using GPU-side data textures, making it suitable for real-time plots with millions of points.
** **
Markers are configured through the marker grouped property, for example marker.shape: QAccelPlot.MarkerShape.Circle. No markers are drawn by default.
** **
Visual effects (gradient stroke, gradient fill) are attached via the effects list property.
** **
Animated data updates are enabled by assigning a DrawTransition or MorphTransition to transition. Several curves can share one transition. Replacing or clearing transition, cancelling it, or appending data during an animation skips to the new data.
** **
stepMode draws the line as steps, for example stepMode: QAccelPlot.StepMode.After. The gradient fill, dash pattern, and hover follow the steps, markers stay on the data points, and interpolated inspection reads the value a step holds. The line follows the data points in order and is not sorted by X.
** **
A data point is invalid when its X or Y coordinate is NaN or ±Inf, or is not strictly positive on a log-scale axis. Invalid data points are never drawn as markers, never hit-tested, and are excluded from auto-ranging coordinate by coordinate (a finite X with an invalid Y still extends the X range). How the line and gradient fill treat them is controlled by the gaps grouped property: gaps.nanMode Break (default) leaves a gap, Connect joins the neighboring valid data points. Insert NaN to mark missing telemetry explicitly. With a step mode and Break, a value holds up to the X of an invalid neighbor when that X is finite.
See also: Axis, SeriesMarker, GradientFill, GradientStroke, DrawTransition, MorphTransition
Public Properties Documentation¶
property antialiasingFeather¶
Antialiasing feather width in pixels, clamped to [0, 10]. Has effect only when the inherited antialiasing istrue . Default: 1.
property color¶
Base line color. Default: Colors.dark.seriesPrimary .
property effects¶
List of visual effects (e.g. GradientFill ,GradientStroke ) applied to this curve.
property gaps¶
Grouped gap-rendering settings, e.g. gaps.nanMode .
property hoverRadius¶
Pick distance in pixels from the line; 0 disables line hover. Markers are picked within their size. Default: 10.
property lineStyle¶
Line style ( SolidLine ,DashLine , orNoLine ). Default:SolidLine .
property lineWidth¶
Line stroke width in pixels. Default: 1.
property marker¶
Grouped marker settings, e.g. marker.shape andmarker.size .
property stepMode¶
How the line joins consecutive data points. Default: StepMode.None .
property transition¶
Optional data transition animation applied when new data arrives.
Public Signals Documentation¶
signal antialiasingFeatherChanged¶
Emitted when the antialiasingFeather property changes.
signal colorChanged¶
Emitted when the color property changes.
signal hoverRadiusChanged¶
Emitted when the hoverRadius property changes.
signal lineStyleChanged¶
Emitted when the lineStyle property changes.
signal lineWidthChanged¶
Emitted when the lineWidth property changes.
signal stepModeChanged¶
Emitted when the stepMode property changes.
signal transitionChanged¶
Emitted when the transition property changes.
Public Functions Documentation¶
function LineCurve¶
Constructs a LineCurve with the given__parent .
function antialiasingFeather¶
Returns the antialiasing feather width in pixels.
function appendData¶
Appends a single data point ( x _,_y ) to the curve. Triggers a redraw.
function clearData¶
Removes all data points from the curve.
Implements QAccelPlot::PlotSeries::clearData
function color¶
Returns the base line color.
function effects¶
Returns the QML list property for attached visual effects.
function gaps¶
Returns the grouped gap-rendering settings. The object is owned by the curve.
function hoverRadius¶
Returns the hover pick distance from the line in pixels.
function legendEntry¶
Returns the legend entry: the symbol, color, line, and marker of the curve.
Implements QAccelPlot::PlotSeries::legendEntry
function lineStyle¶
Returns the active line style.
function lineWidth¶
Returns the line stroke width.
function marker¶
Returns the grouped marker settings. The object is owned by the curve.
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 setAntialiasingFeather¶
Sets the antialiasing feather width to feather pixels, clamped to [0, 10].
function setColor¶
Sets the line color to c .
function setData¶
Replaces the curve data with data (a list of QPointF values).
function setData¶
Sets data from separate X and Y vectors. If sizes don't match, the shorter length is used.
void QAccelPlot::LineCurve::setData (
const std::vector< double > & xs,
const std::vector< double > & ys
)
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::LineCurve::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::LineCurve::setDataF (
std::vector< float > && data,
int count,
const DataBounds & bounds
)
function setHoverRadius¶
Sets the hover pick distance from the line to radius pixels. Negative values are clamped to 0. Marker hit testing is unaffected.
function setLineStyle¶
Sets the line style to style .
function setLineWidth¶
Sets the line stroke width to w pixels.
function setStepMode¶
Sets how the line joins consecutive data points to mode .
function setTransition¶
Sets the data transition to transition .
function stepMode¶
Returns how the line joins consecutive data points.
function transition¶
Returns the active data transition, or nullptr if none.
function ~LineCurve¶
Destroys the curve, ending its animation on the assigned transition.
Protected Functions Documentation¶
function applyDataPoints¶
Applies new points, animating to them when a transition is enabled.
Implements QAccelPlot::PlotSeries::applyDataPoints
function contains¶
Returns true if__point lies within the curve's hit-test region.
function onAxisScaleChanged¶
Refreshes cached geometry when a bound axis changes between linear and log scale.
Implements QAccelPlot::PlotSeries::onAxisScaleChanged
function onDataPointsChanged¶
Refreshes the vertex cache and the hit-test chunks after the points changed.
virtual void QAccelPlot::LineCurve::onDataPointsChanged (
DataChange change,
int previousCount
) override
Implements QAccelPlot::PlotSeries::onDataPointsChanged
The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/series/LineCurve.hpp