Skip to content

Class QAccelPlot::PlotView

ClassList > QAccelPlot > PlotView

The main plot canvas QML item — hosts axes, curves, and a grid. More...

  • #include <PlotView.hpp>

Inherits the following classes: QQuickItem

Inheritance diagram

flowchart TB
  classQAccelPlot_1_1PlotView["QAccelPlot::PlotView"]

  external_base_classQAccelPlot_1_1PlotView_1["QQuickItem"]
  external_base_classQAccelPlot_1_1PlotView_1 --> classQAccelPlot_1_1PlotView

Public Properties

Type Name
property QColor axesAreaColor
Background color of the axes surround area. Default: Colors.dark.axesArea .
property Border * border
Frame inside the plot area's edges, e.g. border.width: 2 . Default: transparent, width 0.
property QQmlListProperty< Axis > extraAxes
Additional axes beyond the primary four; each extra axis must supply its own side.
property Grid * grid
Read-only constant: grid configuration object.
property QQuickItem * overlay
Read-only constant: item that fills the plot and is stacked above the series, the zoom rectangle, and the Plot legend.
property qreal padding
Uniform padding in pixels between the plot area and the canvas edge. Default: 24.
property QColor plotAreaColor
Background color of the plot data area. Default: Colors.dark.plotArea .
property QRectF plotRect
Read-only: plot area rectangle in item-local pixel coordinates.
property PlotRectangleZoom * rectangleZoom
Rectangle zoom configuration and selection state.
property QList< PlotSeries * > series
Read-only: all registered plot series.
property Axis * x2Axis
Optional secondary horizontal axis; assigning it sets its side to Axis.Top .
property Axis * xAxis
Primary horizontal axis; assigning it sets its side to Axis.Bottom .
property Axis * y2Axis
Optional secondary vertical axis; assigning it sets its side to Axis.Right .
property Axis * yAxis
Primary vertical axis; assigning it sets its side to Axis.Left .

Public Signals

Type Name
signal void axesAreaColorChanged
Emitted when the axesAreaColor property changes.
signal void escapePressed
Emitted when Escape is pressed while the plot has focus, so that tools can cancel their gestures.
signal void mouseDoubleClicked (PlotMouseEvent * event)
Emitted when a mouse button is double-clicked over the plot. Call event->accept() to consume the event and suppress built-in handling (rescale all axes).
signal void mouseMoved (PlotMouseEvent * event)
Emitted when the mouse is moved over the plot. Call event->accept() to consume the event and suppress built-in handling (panning or selection updates).
signal void mousePressed (PlotMouseEvent * event)
Emitted when a mouse button is pressed over the plot. Call event->accept() to consume the event and suppress built-in handling (drag start).
signal void mouseReleased (PlotMouseEvent * event)
Emitted when a mouse button is released over the plot. Call event->accept() to consume further built-in handling. A left-button release always ends an active drag.
signal void paddingChanged
Emitted when the padding property changes.
signal void plotAreaColorChanged
Emitted when the plotAreaColor property changes.
signal void plotRectChanged
Emitted when the plotRect changes (axis layout recalculated).
signal void pointerGrabLost
Emitted when the plot loses its mouse grab during a drag.
signal void seriesChanged
Emitted when the set of registered plot series changes.
signal void x2AxisChanged
Emitted when the x2Axis property changes.
signal void xAxisChanged
Emitted when the xAxis property changes.
signal void y2AxisChanged
Emitted when the y2Axis property changes.
signal void yAxisChanged
Emitted when the yAxis property changes.

Public Functions

Type Name
PlotView (QQuickItem * parent=nullptr)
Constructs a PlotView with the given__parent .
QColor axesAreaColor () const
Returns the axes surround background color.
Border * border () const
Returns the plot-area frame settings. The object is owned by the plot.
Q_INVOKABLE qreal dataToPixelX (qreal dataValue) const
Converts a horizontal data-space value to an item-local pixel X coordinate.
Q_INVOKABLE qreal dataToPixelY (qreal dataValue) const
Converts a vertical data-space value to an item-local pixel Y coordinate.
QQmlListProperty< Axis > extraAxes ()
Returns the QML list property for extra axes.
Grid * grid () const
Returns the grid configuration object.
Q_INVOKABLE bool isInsidePlotArea (qreal x, qreal y) const
Returns true _if the item-local point (_x _,_y ) lies inside the plot area.
QQuickItem * overlay () const
Returns the item that holds overlays drawn above the series.
qreal padding () const
Returns the uniform canvas padding in pixels.
Q_INVOKABLE qreal pixelToDataX (qreal pixelX) const
Converts an item-local pixel X coordinate to a horizontal data-space value.
Q_INVOKABLE qreal pixelToDataY (qreal pixelY) const
Converts an item-local pixel Y coordinate to a vertical data-space value.
QColor plotAreaColor () const
Returns the plot area background color.
QRectF plotRect () const
Returns the current plot area rectangle in item-local coordinates.
PlotRectangleZoom * rectangleZoom () const
Returns the rectangle zoom configuration object.
Q_INVOKABLE void rescaleAllAxes ()
Calls Axis::rescaleToData() on all attached axes.
QList< PlotSeries * > series () const
Returns all plot-series children currently registered with this canvas.
void setAxesAreaColor (const QColor & c)
Sets the axes surround background color to c .
void setPadding (qreal p)
Sets the canvas padding to p pixels.
void setPlotAreaColor (const QColor & c)
Sets the plot area background color to c .
void setX2Axis (Axis * axis)
Sets the secondary horizontal axis to axis and assigns it to the top side.
void setXAxis (Axis * axis)
Sets the primary horizontal axis to axis and assigns it to the bottom side.
void setY2Axis (Axis * axis)
Sets the secondary vertical axis to axis and assigns it to the right side.
void setYAxis (Axis * axis)
Sets the primary vertical axis to axis and assigns it to the left side.
Axis * x2Axis () const
Returns the secondary horizontal axis, or nullptr if not set.
Axis * xAxis () const
Returns the primary horizontal axis.
Axis * y2Axis () const
Returns the secondary vertical axis, or nullptr if not set.
Axis * yAxis () const
Returns the primary vertical axis.
Q_INVOKABLE bool zoomToRect (const QRectF & rect)
Zooms all attached axes to an item-local pixel rectangle and returns whether it was applied. Normalizes and clips the rectangle to plotRect; rejects selections smaller than rectangleZoom.minimumSize or ranges that are nonfinite, collapsed, or nonpositive on logarithmic axes. Does not require enabled.
~PlotView () override
Destroys the plot after disconnecting attached axis signals.

Detailed Description

PlotView manages the layout of up to four axes (X, Y, X2, Y2) plus any number of additional axes, and renders LineCurve children via the Qt Scene Graph. Data-to-pixel and pixel-to-data conversion helpers are exposed as invokable methods so overlay items can align themselves to the plot coordinate system.

** **

PlotView {
    Axis { id: xAxis }
    Axis { id: yAxis }
    xAxis: xAxis
    yAxis: yAxis
    LineCurve { xAxis: xAxis; yAxis: yAxis; color: "steelblue" }
}

See also: Axis, LineCurve, Grid

Public Properties Documentation

property axesAreaColor

Background color of the axes surround area. Default: Colors.dark.axesArea .

QColor QAccelPlot::PlotView::axesAreaColor;


property border

Frame inside the plot area's edges, e.g. border.width: 2 . Default: transparent, width 0.

Border* QAccelPlot::PlotView::border;


property extraAxes

Additional axes beyond the primary four; each extra axis must supply its own side.

QQmlListProperty<Axis> QAccelPlot::PlotView::extraAxes;


property grid

Read-only constant: grid configuration object.

Grid* QAccelPlot::PlotView::grid;


property overlay

Read-only constant: item that fills the plot and is stacked above the series, the zoom rectangle, and the Plot legend.

QQuickItem* QAccelPlot::PlotView::overlay;

Crosshair, InspectionMarkers, InspectionTooltip, and the rectangle of a SelectionTool are its children.


property padding

Uniform padding in pixels between the plot area and the canvas edge. Default: 24.

qreal QAccelPlot::PlotView::padding;


property plotAreaColor

Background color of the plot data area. Default: Colors.dark.plotArea .

QColor QAccelPlot::PlotView::plotAreaColor;


property plotRect

Read-only: plot area rectangle in item-local pixel coordinates.

QRectF QAccelPlot::PlotView::plotRect;


property rectangleZoom

Rectangle zoom configuration and selection state.

PlotRectangleZoom* QAccelPlot::PlotView::rectangleZoom;


property series

Read-only: all registered plot series.

QList<PlotSeries*> QAccelPlot::PlotView::series;


property x2Axis

Optional secondary horizontal axis; assigning it sets its side to Axis.Top .

Axis* QAccelPlot::PlotView::x2Axis;


property xAxis

Primary horizontal axis; assigning it sets its side to Axis.Bottom .

Axis* QAccelPlot::PlotView::xAxis;


property y2Axis

Optional secondary vertical axis; assigning it sets its side to Axis.Right .

Axis* QAccelPlot::PlotView::y2Axis;


property yAxis

Primary vertical axis; assigning it sets its side to Axis.Left .

Axis* QAccelPlot::PlotView::yAxis;


Public Signals Documentation

signal axesAreaColorChanged

Emitted when the axesAreaColor property changes.

void QAccelPlot::PlotView::axesAreaColorChanged;


signal escapePressed

Emitted when Escape is pressed while the plot has focus, so that tools can cancel their gestures.

void QAccelPlot::PlotView::escapePressed;


signal mouseDoubleClicked

Emitted when a mouse button is double-clicked over the plot. Call event->accept() to consume the event and suppress built-in handling (rescale all axes).

void QAccelPlot::PlotView::mouseDoubleClicked;


signal mouseMoved

Emitted when the mouse is moved over the plot. Call event->accept() to consume the event and suppress built-in handling (panning or selection updates).

void QAccelPlot::PlotView::mouseMoved;


signal mousePressed

Emitted when a mouse button is pressed over the plot. Call event->accept() to consume the event and suppress built-in handling (drag start).

void QAccelPlot::PlotView::mousePressed;


signal mouseReleased

Emitted when a mouse button is released over the plot. Call event->accept() to consume further built-in handling. A left-button release always ends an active drag.

void QAccelPlot::PlotView::mouseReleased;


signal paddingChanged

Emitted when the padding property changes.

void QAccelPlot::PlotView::paddingChanged;


signal plotAreaColorChanged

Emitted when the plotAreaColor property changes.

void QAccelPlot::PlotView::plotAreaColorChanged;


signal plotRectChanged

Emitted when the plotRect changes (axis layout recalculated).

void QAccelPlot::PlotView::plotRectChanged;


signal pointerGrabLost

Emitted when the plot loses its mouse grab during a drag.

void QAccelPlot::PlotView::pointerGrabLost;


signal seriesChanged

Emitted when the set of registered plot series changes.

void QAccelPlot::PlotView::seriesChanged;


signal x2AxisChanged

Emitted when the x2Axis property changes.

void QAccelPlot::PlotView::x2AxisChanged;


signal xAxisChanged

Emitted when the xAxis property changes.

void QAccelPlot::PlotView::xAxisChanged;


signal y2AxisChanged

Emitted when the y2Axis property changes.

void QAccelPlot::PlotView::y2AxisChanged;


signal yAxisChanged

Emitted when the yAxis property changes.

void QAccelPlot::PlotView::yAxisChanged;


Public Functions Documentation

function PlotView

Constructs a PlotView with the given__parent .

explicit QAccelPlot::PlotView::PlotView (
    QQuickItem * parent=nullptr
) 


function axesAreaColor

Returns the axes surround background color.

QColor QAccelPlot::PlotView::axesAreaColor () const


function border

Returns the plot-area frame settings. The object is owned by the plot.

Border * QAccelPlot::PlotView::border () const


function dataToPixelX

Converts a horizontal data-space value to an item-local pixel X coordinate.

Q_INVOKABLE qreal QAccelPlot::PlotView::dataToPixelX (
    qreal dataValue
) const


function dataToPixelY

Converts a vertical data-space value to an item-local pixel Y coordinate.

Q_INVOKABLE qreal QAccelPlot::PlotView::dataToPixelY (
    qreal dataValue
) const


function extraAxes

Returns the QML list property for extra axes.

QQmlListProperty< Axis > QAccelPlot::PlotView::extraAxes () 


function grid

Returns the grid configuration object.

Grid * QAccelPlot::PlotView::grid () const


function isInsidePlotArea

Returns true _if the item-local point (_x _,_y ) lies inside the plot area.

Q_INVOKABLE bool QAccelPlot::PlotView::isInsidePlotArea (
    qreal x,
    qreal y
) const


function overlay

Returns the item that holds overlays drawn above the series.

QQuickItem * QAccelPlot::PlotView::overlay () const


function padding

Returns the uniform canvas padding in pixels.

qreal QAccelPlot::PlotView::padding () const


function pixelToDataX

Converts an item-local pixel X coordinate to a horizontal data-space value.

Q_INVOKABLE qreal QAccelPlot::PlotView::pixelToDataX (
    qreal pixelX
) const


function pixelToDataY

Converts an item-local pixel Y coordinate to a vertical data-space value.

Q_INVOKABLE qreal QAccelPlot::PlotView::pixelToDataY (
    qreal pixelY
) const


function plotAreaColor

Returns the plot area background color.

QColor QAccelPlot::PlotView::plotAreaColor () const


function plotRect

Returns the current plot area rectangle in item-local coordinates.

QRectF QAccelPlot::PlotView::plotRect () const


function rectangleZoom

Returns the rectangle zoom configuration object.

PlotRectangleZoom * QAccelPlot::PlotView::rectangleZoom () const


function rescaleAllAxes

Calls Axis::rescaleToData() on all attached axes.

Q_INVOKABLE void QAccelPlot::PlotView::rescaleAllAxes () 


function series

Returns all plot-series children currently registered with this canvas.

QList< PlotSeries * > QAccelPlot::PlotView::series () const


function setAxesAreaColor

Sets the axes surround background color to c .

void QAccelPlot::PlotView::setAxesAreaColor (
    const QColor & c
) 


function setPadding

Sets the canvas padding to p pixels.

void QAccelPlot::PlotView::setPadding (
    qreal p
) 


function setPlotAreaColor

Sets the plot area background color to c .

void QAccelPlot::PlotView::setPlotAreaColor (
    const QColor & c
) 


function setX2Axis

Sets the secondary horizontal axis to axis and assigns it to the top side.

void QAccelPlot::PlotView::setX2Axis (
    Axis * axis
) 


function setXAxis

Sets the primary horizontal axis to axis and assigns it to the bottom side.

void QAccelPlot::PlotView::setXAxis (
    Axis * axis
) 


function setY2Axis

Sets the secondary vertical axis to axis and assigns it to the right side.

void QAccelPlot::PlotView::setY2Axis (
    Axis * axis
) 


function setYAxis

Sets the primary vertical axis to axis and assigns it to the left side.

void QAccelPlot::PlotView::setYAxis (
    Axis * axis
) 


function x2Axis

Returns the secondary horizontal axis, or nullptr if not set.

Axis * QAccelPlot::PlotView::x2Axis () const


function xAxis

Returns the primary horizontal axis.

Axis * QAccelPlot::PlotView::xAxis () const


function y2Axis

Returns the secondary vertical axis, or nullptr if not set.

Axis * QAccelPlot::PlotView::y2Axis () const


function yAxis

Returns the primary vertical axis.

Axis * QAccelPlot::PlotView::yAxis () const


function zoomToRect

Zooms all attached axes to an item-local pixel rectangle and returns whether it was applied. Normalizes and clips the rectangle to plotRect; rejects selections smaller than rectangleZoom.minimumSize or ranges that are nonfinite, collapsed, or nonpositive on logarithmic axes. Does not require enabled.

Q_INVOKABLE bool QAccelPlot::PlotView::zoomToRect (
    const QRectF & rect
) 


function ~PlotView

Destroys the plot after disconnecting attached axis signals.

QAccelPlot::PlotView::~PlotView () override



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