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 .
property border¶
Frame inside the plot area's edges, e.g. border.width: 2 . Default: transparent, width 0.
property extraAxes¶
Additional axes beyond the primary four; each extra axis must supply its own side.
property grid¶
Read-only constant: grid configuration object.
property overlay¶
Read-only constant: item that fills the plot and is stacked above the series, the zoom rectangle, and the Plot legend.
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.
property plotAreaColor¶
Background color of the plot data area. Default: Colors.dark.plotArea .
property plotRect¶
Read-only: plot area rectangle in item-local pixel coordinates.
property rectangleZoom¶
Rectangle zoom configuration and selection state.
property series¶
Read-only: all registered plot series.
property x2Axis¶
Optional secondary horizontal axis; assigning it sets its side to Axis.Top .
property xAxis¶
Primary horizontal axis; assigning it sets its side to Axis.Bottom .
property y2Axis¶
Optional secondary vertical axis; assigning it sets its side to Axis.Right .
property yAxis¶
Primary vertical axis; assigning it sets its side to Axis.Left .
Public Signals Documentation¶
signal axesAreaColorChanged¶
Emitted when the axesAreaColor property changes.
signal escapePressed¶
Emitted when Escape is pressed while the plot has focus, so that tools can cancel their gestures.
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).
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).
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).
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.
signal paddingChanged¶
Emitted when the padding property changes.
signal plotAreaColorChanged¶
Emitted when the plotAreaColor property changes.
signal plotRectChanged¶
Emitted when the plotRect changes (axis layout recalculated).
signal pointerGrabLost¶
Emitted when the plot loses its mouse grab during a drag.
signal seriesChanged¶
Emitted when the set of registered plot series changes.
signal x2AxisChanged¶
Emitted when the x2Axis property changes.
signal xAxisChanged¶
Emitted when the xAxis property changes.
signal y2AxisChanged¶
Emitted when the y2Axis property changes.
signal yAxisChanged¶
Emitted when the yAxis property changes.
Public Functions Documentation¶
function PlotView¶
Constructs a PlotView with the given__parent .
function axesAreaColor¶
Returns the axes surround background color.
function border¶
Returns the plot-area frame settings. The object is owned by the plot.
function dataToPixelX¶
Converts a horizontal data-space value to an item-local pixel X coordinate.
function dataToPixelY¶
Converts a vertical data-space value to an item-local pixel Y coordinate.
function extraAxes¶
Returns the QML list property for extra axes.
function grid¶
Returns the grid configuration object.
function isInsidePlotArea¶
Returns true _if the item-local point (_x _,_y ) lies inside the plot area.
function overlay¶
Returns the item that holds overlays drawn above the series.
function padding¶
Returns the uniform canvas padding in pixels.
function pixelToDataX¶
Converts an item-local pixel X coordinate to a horizontal data-space value.
function pixelToDataY¶
Converts an item-local pixel Y coordinate to a vertical data-space value.
function plotAreaColor¶
Returns the plot area background color.
function plotRect¶
Returns the current plot area rectangle in item-local coordinates.
function rectangleZoom¶
Returns the rectangle zoom configuration object.
function rescaleAllAxes¶
Calls Axis::rescaleToData() on all attached axes.
function series¶
Returns all plot-series children currently registered with this canvas.
function setAxesAreaColor¶
Sets the axes surround background color to c .
function setPadding¶
Sets the canvas padding to p pixels.
function setPlotAreaColor¶
Sets the plot area background color to c .
function setX2Axis¶
Sets the secondary horizontal axis to axis and assigns it to the top side.
function setXAxis¶
Sets the primary horizontal axis to axis and assigns it to the bottom side.
function setY2Axis¶
Sets the secondary vertical axis to axis and assigns it to the right side.
function setYAxis¶
Sets the primary vertical axis to axis and assigns it to the left side.
function x2Axis¶
Returns the secondary horizontal axis, or nullptr if not set.
function xAxis¶
Returns the primary horizontal axis.
function y2Axis¶
Returns the secondary vertical axis, or nullptr if not set.
function yAxis¶
Returns the primary vertical axis.
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.
function ~PlotView¶
Destroys the plot after disconnecting attached axis signals.
The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/PlotView.hpp