Skip to content

Class QAccelPlot::PlotInspector

ClassList > QAccelPlot > PlotInspector

Inspects the visible XY series and heatmaps of a plot at a cursor and publishes one model row per series. More...

  • #include <PlotInspector.hpp>

Inherits the following classes: QObject

Inheritance diagram

flowchart TB
  classQAccelPlot_1_1PlotInspector["QAccelPlot::PlotInspector"]

  external_base_classQAccelPlot_1_1PlotInspector_1["QObject"]
  external_base_classQAccelPlot_1_1PlotInspector_1 --> classQAccelPlot_1_1PlotInspector

Public Types

Type Name
enum Mode
How each series is matched to the cursor.

Public Properties

Type Name
property bool active
True while enabled and the cursor is inside the plot area.
property QPointF crosshairPosition
Crosshair position in plot-local logical pixels: the cursor's, or the matched data point's with snapToDataPoint . A coordinate the cursor lacks is NaN.
property qreal cursorPixelX
Cursor X in plot-local logical pixels, the pixel of cursorX ; NaN when the cursor has no X.
property qreal cursorPixelY
Cursor Y in plot-local logical pixels, the pixel of cursorY ; seecursorPixelX .
property qreal cursorX
Cursor X on the plot's primary X axis: the pointer's while followPointer is true, NaN when it is outside.
property QString cursorXText
Crosshair X formatted by the plot's primary X axis.
property qreal cursorY
Cursor Y on the plot's primary Y axis; see cursorX . NaN leaves the cursor without a Y.
property QString cursorYText
Crosshair Y formatted by the plot's primary Y axis; empty without a cursor Y.
property QQmlListProperty< QObject > data
Default property: objects declared inside the inspector.
property bool enabled
Enables queries. A disabled inspector is inactive and does no work. Default: true.
property QList< PlotSeries * > excludedSeries
Series never inspected, even when listed in includedSeries .
property bool followPointer
Whether the cursor follows the plot's pointer. When false it stays at cursorX andcursorY . Default: true.
property QList< PlotSeries * > includedSeries
Series to inspect; an empty list inspects every series of the plot.
property bool interpolate
In NearestX andNearestY mode, reports the point on the line between two consecutive data points instead of the nearer one. Default: false.
property Mode mode
NearestX andNearestY report each series at the cursor's X or Y;NearestXY picks by on-screen distance. Default: NearestX.
property InspectionRowModel * model
Read-only constant: one row per inspected series.
property PlotView * plot
Plot whose series are inspected.
property qreal radius
Pick distance in logical pixels. In NearestX andNearestY mode it only limits matches beyond a series' extreme data points. Default: 16.
property bool snapToDataPoint
Moves the crosshair to the closest matching data point. Default: false.
property bool summaries
Adds Y statistics of the data points around the cursor to every row. Default: false.
property qreal summaryRadius
Half-width of the summary neighborhood in logical pixels. Default: 0.5.
property int validCount
Number of rows with a matching data point.

Public Signals

Type Name
signal void activeChanged
Emitted when the active property changes.
signal void crosshairPositionChanged
Emitted when the crosshairPosition property changes.
signal void cursorChanged
Emitted when the cursor coordinates or their texts change.
signal void enabledChanged
Emitted when the enabled property changes.
signal void excludedSeriesChanged
Emitted when the excludedSeries property changes.
signal void followPointerChanged
Emitted when the followPointer property changes.
signal void includedSeriesChanged
Emitted when the includedSeries property changes.
signal void interpolateChanged
Emitted when the interpolate property changes.
signal void modeChanged
Emitted when the mode property changes.
signal void plotChanged
Emitted when the plot property changes.
signal void radiusChanged
Emitted when the radius property changes.
signal void refreshed
Emitted after every refresh that published results.
signal void snapToDataPointChanged
Emitted when the snapToDataPoint property changes.
signal void summariesChanged
Emitted when the summaries property changes.
signal void summaryRadiusChanged
Emitted when the summaryRadius property changes.
signal void validCountChanged
Emitted when the validCount property changes.

Public Functions

Type Name
PlotInspector (QObject * parent=nullptr)
Constructs an inspector without a plot.
bool active () const
Returns whether the cursor is inside the plot area.
QPointF crosshairPosition () const
Returns the crosshair position in plot-local logical pixels.
qreal cursorPixelX () const
Returns the cursor X in plot-local logical pixels.
qreal cursorPixelY () const
Returns the cursor Y in plot-local logical pixels.
qreal cursorX () const
Returns the cursor X on the plot's primary X axis.
QString cursorXText () const
Returns the formatted crosshair X.
qreal cursorY () const
Returns the cursor Y on the plot's primary Y axis.
QString cursorYText () const
Returns the formatted crosshair Y.
QQmlListProperty< QObject > data ()
Returns the objects declared inside the inspector.
bool enabled () const
Returns whether queries are enabled.
QList< PlotSeries * > excludedSeries () const
Returns the series never inspected, without destroyed entries.
bool followPointer () const
Returns whether the cursor follows the plot's pointer.
QList< PlotSeries * > includedSeries () const
Returns the series to inspect, without destroyed entries.
bool interpolate () const
Returns whether NearestX andNearestY rows are interpolated between data points.
Mode mode () const
Returns the matching mode.
InspectionRowModel * model () const
Returns the row model.
PlotView * plot () const
Returns the inspected plot.
qreal radius () const
Returns the pick distance in logical pixels.
Q_INVOKABLE void refresh ()
Runs the queries now instead of on the next event-loop pass.
void setCursorPixelX (qreal x)
Sets the cursor X in plot-local logical pixels used while followPointer is false.
void setCursorPixelY (qreal y)
Sets the cursor Y in plot-local logical pixels used while followPointer is false.
void setCursorX (qreal x)
Sets the cursor X used while followPointer is false.
void setCursorY (qreal y)
Sets the cursor Y used while followPointer is false.
void setEnabled (bool enabled)
Enables or disables queries.
void setExcludedSeries (const QList< PlotSeries * > & series)
Sets the series never inspected.
void setFollowPointer (bool follow)
Switches between following the pointer and a cursor set from code.
void setIncludedSeries (const QList< PlotSeries * > & series)
Sets the series to inspect.
void setInterpolate (bool enabled)
Enables or disables interpolation between consecutive data points.
void setMode (Mode mode)
Sets the matching mode.
void setPlot (PlotView * plot)
Sets the inspected plot.
void setRadius (qreal radius)
Sets the pick distance; negative and NaN values are ignored.
void setSnapToDataPoint (bool enabled)
Enables or disables crosshair snapping.
void setSummaries (bool enabled)
Enables or disables neighborhood statistics.
void setSummaryRadius (qreal radius)
Sets the summary half-width; negative and nonfinite values are ignored.
bool snapToDataPoint () const
Returns whether the crosshair snaps to the closest matching data point.
Q_INVOKABLE void stepCursor (int steps)
Moves the cursor steps source records along the first matching XY series and stops following the pointer.
bool summaries () const
Returns whether rows include neighborhood statistics.
qreal summaryRadius () const
Returns the summary half-width in logical pixels.
int validCount () const
Returns the number of rows with a matching data point.
~PlotInspector () override
Destroys the inspector and the objects declared inside it.

Detailed Description

Series that draw data points as areas, such as HeatmapSeries, report the record under the cursor in every mode, and only while the cursor has both coordinates; radius, interpolate, and summaries do not apply to them, and snapToDataPoint moves both crosshair coordinates to the record's center.

The cursor follows the plot's pointer by default; set followPointer to false and write cursorX to drive it from code, for example to link the crosshairs of several plots, or cursorPixelX to keep it at a pixel while the axes pan or zoom. Results are refreshed at most once per event-loop pass.

In QML, declare Crosshair, InspectionMarkers, and InspectionTooltip inside the inspector: they receive it as their inspector and are stacked in declaration order, the last one on top.

See also: SeriesInspection, InspectionRowModel

Public Types Documentation

enum Mode

How each series is matched to the cursor.

enum QAccelPlot::PlotInspector::Mode {
    NearestX,
    NearestY,
    NearestXY
};


Public Properties Documentation

property active

True while enabled and the cursor is inside the plot area.

bool QAccelPlot::PlotInspector::active;


property crosshairPosition

Crosshair position in plot-local logical pixels: the cursor's, or the matched data point's with snapToDataPoint . A coordinate the cursor lacks is NaN.

QPointF QAccelPlot::PlotInspector::crosshairPosition;


property cursorPixelX

Cursor X in plot-local logical pixels, the pixel of cursorX ; NaN when the cursor has no X.

qreal QAccelPlot::PlotInspector::cursorPixelX;

A written value is used while followPointer is false. It stays at the same pixel when the axes pan or zoom, and cursorX reports the data under it. Writing cursorX places the cursor in data units again.


property cursorPixelY

Cursor Y in plot-local logical pixels, the pixel of cursorY ; seecursorPixelX .

qreal QAccelPlot::PlotInspector::cursorPixelY;


property cursorX

Cursor X on the plot's primary X axis: the pointer's while followPointer is true, NaN when it is outside.

qreal QAccelPlot::PlotInspector::cursorX;

A written value is used while followPointer is false.


property cursorXText

Crosshair X formatted by the plot's primary X axis.

QString QAccelPlot::PlotInspector::cursorXText;


property cursorY

Cursor Y on the plot's primary Y axis; see cursorX . NaN leaves the cursor without a Y.

qreal QAccelPlot::PlotInspector::cursorY;


property cursorYText

Crosshair Y formatted by the plot's primary Y axis; empty without a cursor Y.

QString QAccelPlot::PlotInspector::cursorYText;


property data

Default property: objects declared inside the inspector.

QQmlListProperty<QObject> QAccelPlot::PlotInspector::data;

Every object with an inspector property receives this inspector. Items among them are stacked in declaration order above the other children of the plot's overlay.


property enabled

Enables queries. A disabled inspector is inactive and does no work. Default: true.

bool QAccelPlot::PlotInspector::enabled;


property excludedSeries

Series never inspected, even when listed in includedSeries .

QList<PlotSeries*> QAccelPlot::PlotInspector::excludedSeries;


property followPointer

Whether the cursor follows the plot's pointer. When false it stays at cursorX andcursorY . Default: true.

bool QAccelPlot::PlotInspector::followPointer;


property includedSeries

Series to inspect; an empty list inspects every series of the plot.

QList<PlotSeries*> QAccelPlot::PlotInspector::includedSeries;


property interpolate

In NearestX andNearestY mode, reports the point on the line between two consecutive data points instead of the nearer one. Default: false.

bool QAccelPlot::PlotInspector::interpolate;


property mode

NearestX andNearestY report each series at the cursor's X or Y;NearestXY picks by on-screen distance. Default: NearestX.

Mode QAccelPlot::PlotInspector::mode;


property model

Read-only constant: one row per inspected series.

InspectionRowModel* QAccelPlot::PlotInspector::model;


property plot

Plot whose series are inspected.

PlotView* QAccelPlot::PlotInspector::plot;


property radius

Pick distance in logical pixels. In NearestX andNearestY mode it only limits matches beyond a series' extreme data points. Default: 16.

qreal QAccelPlot::PlotInspector::radius;


property snapToDataPoint

Moves the crosshair to the closest matching data point. Default: false.

bool QAccelPlot::PlotInspector::snapToDataPoint;


property summaries

Adds Y statistics of the data points around the cursor to every row. Default: false.

bool QAccelPlot::PlotInspector::summaries;


property summaryRadius

Half-width of the summary neighborhood in logical pixels. Default: 0.5.

qreal QAccelPlot::PlotInspector::summaryRadius;


property validCount

Number of rows with a matching data point.

int QAccelPlot::PlotInspector::validCount;


Public Signals Documentation

signal activeChanged

Emitted when the active property changes.

void QAccelPlot::PlotInspector::activeChanged;


signal crosshairPositionChanged

Emitted when the crosshairPosition property changes.

void QAccelPlot::PlotInspector::crosshairPositionChanged;


signal cursorChanged

Emitted when the cursor coordinates or their texts change.

void QAccelPlot::PlotInspector::cursorChanged;


signal enabledChanged

Emitted when the enabled property changes.

void QAccelPlot::PlotInspector::enabledChanged;


signal excludedSeriesChanged

Emitted when the excludedSeries property changes.

void QAccelPlot::PlotInspector::excludedSeriesChanged;


signal followPointerChanged

Emitted when the followPointer property changes.

void QAccelPlot::PlotInspector::followPointerChanged;


signal includedSeriesChanged

Emitted when the includedSeries property changes.

void QAccelPlot::PlotInspector::includedSeriesChanged;


signal interpolateChanged

Emitted when the interpolate property changes.

void QAccelPlot::PlotInspector::interpolateChanged;


signal modeChanged

Emitted when the mode property changes.

void QAccelPlot::PlotInspector::modeChanged;


signal plotChanged

Emitted when the plot property changes.

void QAccelPlot::PlotInspector::plotChanged;


signal radiusChanged

Emitted when the radius property changes.

void QAccelPlot::PlotInspector::radiusChanged;


signal refreshed

Emitted after every refresh that published results.

void QAccelPlot::PlotInspector::refreshed;


signal snapToDataPointChanged

Emitted when the snapToDataPoint property changes.

void QAccelPlot::PlotInspector::snapToDataPointChanged;


signal summariesChanged

Emitted when the summaries property changes.

void QAccelPlot::PlotInspector::summariesChanged;


signal summaryRadiusChanged

Emitted when the summaryRadius property changes.

void QAccelPlot::PlotInspector::summaryRadiusChanged;


signal validCountChanged

Emitted when the validCount property changes.

void QAccelPlot::PlotInspector::validCountChanged;


Public Functions Documentation

function PlotInspector

Constructs an inspector without a plot.

explicit QAccelPlot::PlotInspector::PlotInspector (
    QObject * parent=nullptr
) 


function active

Returns whether the cursor is inside the plot area.

bool QAccelPlot::PlotInspector::active () const


function crosshairPosition

Returns the crosshair position in plot-local logical pixels.

QPointF QAccelPlot::PlotInspector::crosshairPosition () const


function cursorPixelX

Returns the cursor X in plot-local logical pixels.

qreal QAccelPlot::PlotInspector::cursorPixelX () const


function cursorPixelY

Returns the cursor Y in plot-local logical pixels.

qreal QAccelPlot::PlotInspector::cursorPixelY () const


function cursorX

Returns the cursor X on the plot's primary X axis.

qreal QAccelPlot::PlotInspector::cursorX () const


function cursorXText

Returns the formatted crosshair X.

QString QAccelPlot::PlotInspector::cursorXText () const


function cursorY

Returns the cursor Y on the plot's primary Y axis.

qreal QAccelPlot::PlotInspector::cursorY () const


function cursorYText

Returns the formatted crosshair Y.

QString QAccelPlot::PlotInspector::cursorYText () const


function data

Returns the objects declared inside the inspector.

QQmlListProperty< QObject > QAccelPlot::PlotInspector::data () 


function enabled

Returns whether queries are enabled.

bool QAccelPlot::PlotInspector::enabled () const


function excludedSeries

Returns the series never inspected, without destroyed entries.

QList< PlotSeries * > QAccelPlot::PlotInspector::excludedSeries () const


function followPointer

Returns whether the cursor follows the plot's pointer.

bool QAccelPlot::PlotInspector::followPointer () const


function includedSeries

Returns the series to inspect, without destroyed entries.

QList< PlotSeries * > QAccelPlot::PlotInspector::includedSeries () const


function interpolate

Returns whether NearestX andNearestY rows are interpolated between data points.

bool QAccelPlot::PlotInspector::interpolate () const


function mode

Returns the matching mode.

Mode QAccelPlot::PlotInspector::mode () const


function model

Returns the row model.

InspectionRowModel * QAccelPlot::PlotInspector::model () const


function plot

Returns the inspected plot.

PlotView * QAccelPlot::PlotInspector::plot () const


function radius

Returns the pick distance in logical pixels.

qreal QAccelPlot::PlotInspector::radius () const


function refresh

Runs the queries now instead of on the next event-loop pass.

Q_INVOKABLE void QAccelPlot::PlotInspector::refresh () 


function setCursorPixelX

Sets the cursor X in plot-local logical pixels used while followPointer is false.

void QAccelPlot::PlotInspector::setCursorPixelX (
    qreal x
) 


function setCursorPixelY

Sets the cursor Y in plot-local logical pixels used while followPointer is false.

void QAccelPlot::PlotInspector::setCursorPixelY (
    qreal y
) 


function setCursorX

Sets the cursor X used while followPointer is false.

void QAccelPlot::PlotInspector::setCursorX (
    qreal x
) 


function setCursorY

Sets the cursor Y used while followPointer is false.

void QAccelPlot::PlotInspector::setCursorY (
    qreal y
) 


function setEnabled

Enables or disables queries.

void QAccelPlot::PlotInspector::setEnabled (
    bool enabled
) 


function setExcludedSeries

Sets the series never inspected.

void QAccelPlot::PlotInspector::setExcludedSeries (
    const QList< PlotSeries * > & series
) 


function setFollowPointer

Switches between following the pointer and a cursor set from code.

void QAccelPlot::PlotInspector::setFollowPointer (
    bool follow
) 


function setIncludedSeries

Sets the series to inspect.

void QAccelPlot::PlotInspector::setIncludedSeries (
    const QList< PlotSeries * > & series
) 


function setInterpolate

Enables or disables interpolation between consecutive data points.

void QAccelPlot::PlotInspector::setInterpolate (
    bool enabled
) 


function setMode

Sets the matching mode.

void QAccelPlot::PlotInspector::setMode (
    Mode mode
) 


function setPlot

Sets the inspected plot.

void QAccelPlot::PlotInspector::setPlot (
    PlotView * plot
) 


function setRadius

Sets the pick distance; negative and NaN values are ignored.

void QAccelPlot::PlotInspector::setRadius (
    qreal radius
) 


function setSnapToDataPoint

Enables or disables crosshair snapping.

void QAccelPlot::PlotInspector::setSnapToDataPoint (
    bool enabled
) 


function setSummaries

Enables or disables neighborhood statistics.

void QAccelPlot::PlotInspector::setSummaries (
    bool enabled
) 


function setSummaryRadius

Sets the summary half-width; negative and nonfinite values are ignored.

void QAccelPlot::PlotInspector::setSummaryRadius (
    qreal radius
) 


function snapToDataPoint

Returns whether the crosshair snaps to the closest matching data point.

bool QAccelPlot::PlotInspector::snapToDataPoint () const


function stepCursor

Moves the cursor steps source records along the first matching XY series and stops following the pointer.

Q_INVOKABLE void QAccelPlot::PlotInspector::stepCursor (
    int steps
) 


function summaries

Returns whether rows include neighborhood statistics.

bool QAccelPlot::PlotInspector::summaries () const


function summaryRadius

Returns the summary half-width in logical pixels.

qreal QAccelPlot::PlotInspector::summaryRadius () const


function validCount

Returns the number of rows with a matching data point.

int QAccelPlot::PlotInspector::validCount () const


function ~PlotInspector

Destroys the inspector and the objects declared inside it.

QAccelPlot::PlotInspector::~PlotInspector () override



The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/inspection/PlotInspector.hpp