Class QAccelPlot::BarSeries¶
ClassList > QAccelPlot > BarSeries
A hardware-accelerated QML item that renders a bar chart. More...
#include <BarSeries.hpp>
Inherits the following classes: QAccelPlot::ColormappedSeries
Inheritance diagram¶
flowchart TB
classQAccelPlot_1_1BarSeries["QAccelPlot::BarSeries"]
classQAccelPlot_1_1ColormappedSeries["QAccelPlot::ColormappedSeries"]
classQAccelPlot_1_1ColormappedSeries --> classQAccelPlot_1_1BarSeries
click classQAccelPlot_1_1ColormappedSeries "../classQAccelPlot_1_1ColormappedSeries/" "Open QAccelPlot::ColormappedSeries"
classQAccelPlot_1_1PlotSeries["QAccelPlot::PlotSeries"]
classQAccelPlot_1_1PlotSeries --> classQAccelPlot_1_1ColormappedSeries
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¶
| Type | Name |
|---|---|
| enum | ColorSource The part of a bar that the colormap maps to its color. |
Public Types inherited from QAccelPlot::PlotSeries¶
| Type | Name |
|---|---|
| enum | LegendSymbol Supported default legend symbols. |
Public Properties¶
| Type | Name |
|---|---|
| property qreal | barOffset Shift of every bar along the position axis in data units, e.g. for grouped bars. Default: 0. |
| property qreal | barWidth Bar width in position-axis data units. Default: 0.8. Clamped to at least 0. |
| property qreal | baselineValue Value the bars start from. Default: 0. |
| property Border * | border Outline inside each bar's edges, e.g. border.width: 1 . Default: black, width 0. |
| property QQmlListProperty< Category > | categories The bars' categories. Default: empty. |
| property QColor | color Fill color of bars without a category color. Default: Colors.dark.seriesPrimary . |
| property ColorSource | colorSource What the colormap maps to a bar's color. Default:Value . |
| property QColor | hoverColor Fill color of the bar under the cursor. Default: an invalid color, no highlight. |
| property int | hoveredIndex Read-only: index of the bar under the cursor, or -1 when none. |
| property qreal | minimumWidth Minimum drawn bar width in pixels, so bars stay visible when zoomed out. Default: 1. Clamped to at least 0. |
| property Qt::Orientation | orientation Direction the bars grow in. Default: Qt.Vertical , positions on the X axis and values on the Y axis. |
| property DataTransition * | transition Optional data transition animation applied when new data arrives. |
Public Properties inherited from QAccelPlot::ColormappedSeries¶
See QAccelPlot::ColormappedSeries
| Type | Name |
|---|---|
| property Colormap * | colormap Maps values to colors. What a series draws without one is described by the series. |
| property qreal | dataValueMax Read-only: upper bound of the value range, taken from Colormap::max when it is set and from the data otherwise. |
| property qreal | dataValueMin Read-only: lower bound of the value range, taken from Colormap::min when it is set and from the data otherwise.ColorBar labels its ticks from this anddataValueMax . |
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 | barOffsetChanged Emitted when the barOffset property changes. |
| signal void | barWidthChanged Emitted when the barWidth property changes. |
| signal void | baselineValueChanged Emitted when the baselineValue property changes. |
| signal void | categoriesChanged Emitted when a category is added, removed, or edited. |
| signal void | colorChanged Emitted when the color property changes. |
| signal void | colorSourceChanged Emitted when the colorSource property changes. |
| signal void | hoverColorChanged Emitted when the hoverColor property changes. |
| signal void | hoveredIndexChanged Emitted when the hovered bar index changes. |
| signal void | minimumWidthChanged Emitted when the minimumWidth property changes. |
| signal void | orientationChanged Emitted when the orientation property changes. |
| signal void | transitionChanged Emitted when the transition property changes. |
Public Signals inherited from QAccelPlot::ColormappedSeries¶
See QAccelPlot::ColormappedSeries
| Type | Name |
|---|---|
| signal void | colormapChanged Emitted when the colormap property changes. |
| signal void | valueRangeChanged Emitted when dataValueMin ordataValueMax 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 |
|---|---|
| BarSeries (QQuickItem * parent=nullptr) Constructs a BarSeries with the given__parent . |
|
| Q_INVOKABLE QVariantMap | barAt (int index) const Returns bar index as an object with position andvalue , orfrom ,to , andvalue for a ranged bar. |
| int | barIndexAt (const QPointF & position) const Returns the index of the topmost bar under item position position , or -1. |
| qreal | barOffset () const Returns the shift of every bar along the position axis in data units. |
| qreal | barWidth () const Returns the bar width in position-axis data units. |
| qreal | baselineValue () const Returns the value the bars start from. |
| Border * | border () const Returns the grouped outline settings. The object is owned by the series. |
| QQmlListProperty< Category > | categories () Returns the categories as a QML list. |
| virtual Q_INVOKABLE void | clearData () override Removes all bars. |
| QColor | color () const Returns the bar fill color. |
| ColorSource | colorSource () const Returns what the colormap maps to a bar's color. |
| bool | contains (const QPointF & point) override const Returns true when a bar lies under item position__point . |
| QColor | hoverColor () const Returns the fill color of the hovered bar. |
| int | hoveredIndex () const Returns the index of the hovered bar, or -1 if none. |
| virtual QList< LegendEntry > | legendEntries () override const Returns one legend entry per category, or the legendEntry() when there are no categories or acolormap is assigned. |
| virtual std::optional< LegendEntry > | legendEntry () override const Returns the legend entry: the symbol and color of the bars. |
| qreal | minimumWidth () const Returns the minimum drawn bar width in pixels. |
| Qt::Orientation | orientation () const Returns the direction the bars grow in. |
| void | postData (std::vector< double > && data, std::vector< int > && categories, int barCount) Thread-safe: queues setData _(_data _,_categories _,_barCount ) to the item's thread. |
| void | postData (std::vector< float > && data, std::vector< int > && categories, int barCount) Thread-safe: queues setDataF _(_data _,_categories _,_barCount ) to the item's thread. |
| 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 | postRangedData (std::vector< double > && data, int barCount) Thread-safe: queues setRangedData _(_data _,_barCount ) to the item's thread. |
| void | setBarOffset (qreal offset) Sets the shift of every bar along the position axis to offset data units. |
| void | setBarWidth (qreal width) Sets the bar width to width data units. Negative values are clamped to 0. |
| void | setBaselineValue (qreal baselineValue) Sets the value the bars start from to baselineValue . NaN is ignored. |
| void | setCategories (const QList< Category * > & categories) Replaces the categories with categories . The series does not take ownership. |
| void | setColor (const QColor & color) Sets the fill color to color . |
| void | setColorSource (ColorSource source) Sets what the colormap maps to a bar's color to source . |
| Q_INVOKABLE void | setData (const QVariantList & bars) Loads bars from bars , a QML list of numbers or objects. |
| void | setData (std::vector< double > && data, std::vector< int > && categories, int barCount) Moves data and per-bar category values__categories (empty, or exactly__barCount ) into the series. |
| 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 (std::vector< float > && data, std::vector< int > && categories, int barCount) Like setDataF _(_data _,_barCount ) and also moves per-bar category values__categories (empty, or exactly__barCount ) into the series. |
| 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. |
| Q_INVOKABLE void | setDataPointCategories (const QVariantList & categories) Sets one category per bar, each a category value orname . |
| void | setHoverColor (const QColor & color) Sets the fill color of the hovered bar to color . An invalid color disables the highlight. |
| void | setMinimumWidth (qreal width) Sets the minimum drawn bar width to width pixels. Negative values are clamped to 0. |
| void | setOrientation (Qt::Orientation orientation) Sets the direction the bars grow in to orientation . |
| void | setRangedData (std::vector< double > && data, int barCount) Moves ranged bars into the series: data holds__barCount × 3 doubles (from, to, value). Clears categories. |
| void | setRangedData (std::vector< double > && data, std::vector< int > && categories, int barCount) Like setRangedData _(_data _,_barCount ) and also moves per-bar category values__categories (empty, or exactly__barCount ) into the series. |
| void | setTransition (DataTransition * transition) Sets the data transition to transition . |
| DataTransition * | transition () const Returns the active data transition, or nullptr if none. |
| ~BarSeries () override Destroys the series, ending its animation on the assigned transition. |
Public Functions inherited from QAccelPlot::ColormappedSeries¶
See QAccelPlot::ColormappedSeries
| Type | Name |
|---|---|
| Colormap * | colormap () const Returns the colormap, or nullptr when none is assigned. |
| qreal | dataValueMax () const Returns the resolved upper bound of the value range. |
| qreal | dataValueMin () const Returns the resolved lower bound of the value range. |
| void | setColormap (Colormap * colormap) Sets the colormap to colormap . |
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 (position, value) bars, animating to them when a transition is enabled. |
| virtual DataRanges | computeDataRanges () override const Scans the records for their extents. The default implementation scans the data points. |
| virtual int | dataPointValueCount () override const Returns 2: setData() andsetDataF() take (position, value) bars, whatever the current layout. |
| void | hoverEnterEvent (QHoverEvent * event) override |
| void | hoverLeaveEvent (QHoverEvent * event) override |
| void | hoverMoveEvent (QHoverEvent * event) override |
| virtual InspectionRecord | inspectionRecord (int index) override const Returns the bar at index with its position, value, and category. |
| virtual InspectionRecord | inspectionRecordAt (const QPointF & position) override const Returns the bar drawn at the series-local position . |
| virtual void | onAxisScaleChanged () override Repaints with the coordinates mapped for the new scale. |
| virtual void | onDataPointsChanged (DataChange change, int previousCount) override Refreshes the vertices, the hover index, the count, and the value range after the bars changed. |
| virtual bool | recordInspectionSupported () override const Returns true: bars are inspected as records. |
| virtual std::optional< ValueSpan > | scanValueRange () override const Returns the span of the finite colorSource values while a colormap is assigned. |
| QSGNode * | updatePaintNode (QSGNode * oldNode, UpdatePaintNodeData *) override |
Protected Functions inherited from QAccelPlot::ColormappedSeries¶
See QAccelPlot::ColormappedSeries
| Type | Name |
|---|---|
| ColormappedSeries (DataPointStore::Layout layout, DataPointWording wording, QQuickItem * parent) Creates a series whose data points have layout _;_wording names them in warnings. |
|
| const std::vector< GradientStopData > & | colorStops () const Returns the ramp stops of the colormap, empty without one. |
| virtual std::optional< ValueSpan > | scanValueRange () const Returns the span of the finite values, or std::nullopt when there is none. Default: none. |
| void | updateValueRange () Resolves the value range again. Call after every change of the values. |
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¶
Each bar is a (position, value) pair. A vertical bar is centered on position along the X axis and spans from baselineValue to value along the Y axis; orientation Qt.Horizontal swaps the axes. Bars are uploaded to the GPU as a float data texture of two floats per bar, and barWidth, barOffset, and baselineValue are applied in the shader, so changing them does not re-upload the data. The setData() overloads keep doubles and upload them relative to an origin near the data, so large positions such as epoch timestamps stay precise.
Bars with a NaN or infinite position, or a NaN value, are not drawn or hovered. An infinite value extends the bar to the plot edge. Values below baselineValue extend the bar the other way.
A ranged bar is a (from, to, value) triple that spans from from to to along the position axis, e.g. a histogram bin. barWidth and barOffset do not apply to ranged bars. A ranged bar with a NaN edge is not drawn, and an infinite edge extends it to the plot edge. A series holds either ranged bars or (position, value) bars.
Each bar can carry a category. List the categories in categories as Category objects, as in QAccelPlot.Category { value: 0; name: "Loss"; color: "red" }. A bar is filled with the color of the category whose value equals its category. Bars without a category, or whose category has no color or is not listed, use color. The legend shows one row per category unless a colormap is assigned. For grouped bars, use one series per group with a narrower barWidth and a different barOffset.
Set antialiasing to smooth edges that fall between pixels. It is off by default because bars that touch, such as histogram bins, then show faint seams.
** **
Assign a colormap to color each bar by colorSource: its value, or its position. The position of a ranged bar is the middle of its edges as the colormap places them, and barOffset does not apply. A colormap with at least two stops overrides color and the category colors, and hoverColor still marks the hovered bar. Values outside the value range take the color at its nearer end. A bar whose source the colormap cannot map, such as a non-positive one under Colormap::logScale, keeps color or its category color. Under logScale, an unset bound resolved from such a bar is not positive, so every bar keeps its color; set Colormap::min above zero. Bars can be histogram bins colored by their bin, with a ColorBar or the position axis as the key:
QAccelPlot.BarSeries {
orientation: Qt.Horizontal
colorSource: QAccelPlot.BarSeries.Position
colormap: QAccelPlot.Colormap { preset: QAccelPlot.Colormap.Viridis }
}
The value range is scanned only while a colormap is assigned, so streaming bars without one does not scan them. Without a colormap, dataValueMin and dataValueMax are 0 and 1.
** **
Assign a MorphTransition or DrawTransition to transition to animate data updates. With MorphTransition, bars move to their new position and value, new bars grow from baselineValue, and removed bars shrink to it. Bars that change between ranged and (position, value) all grow in. count, barAt(), the data ranges, hover, and inspection use the new data from the start of the animation. While a transition is enabled, the setDataF() overloads store doubles. clearData(), and replacing, clearing, or cancelling transition, skip to the new data.
** **
Up to 16,777,216 (2^24) bars are drawn correctly, as the shader indexes bars in single precision.
See also: RectangleSeries, Axis, Colormap, ColorBar, MorphTransition, DrawTransition
Public Types Documentation¶
enum ColorSource¶
The part of a bar that the colormap maps to its color.
Public Properties Documentation¶
property barOffset¶
Shift of every bar along the position axis in data units, e.g. for grouped bars. Default: 0.
property barWidth¶
Bar width in position-axis data units. Default: 0.8. Clamped to at least 0.
property baselineValue¶
Value the bars start from. Default: 0.
-Infinity, or a non-positive baseline on a logarithmic value axis, starts the bars at the plot edge.
property border¶
Outline inside each bar's edges, e.g. border.width: 1 . Default: black, width 0.
On bars too small for two outlines, the outline narrows so at least 1 px of fill stays visible.
property categories¶
The bars' categories. Default: empty.
The first of categories that share a value or a name wins, and the others log a warning. Edits to a listed Category apply at once.
property color¶
Fill color of bars without a category color. Default: Colors.dark.seriesPrimary .
property colorSource¶
What the colormap maps to a bar's color. Default:Value .
property hoverColor¶
Fill color of the bar under the cursor. Default: an invalid color, no highlight.
property hoveredIndex¶
Read-only: index of the bar under the cursor, or -1 when none.
property minimumWidth¶
Minimum drawn bar width in pixels, so bars stay visible when zoomed out. Default: 1. Clamped to at least 0.
property orientation¶
Direction the bars grow in. Default: Qt.Vertical , positions on the X axis and values on the Y axis.
property transition¶
Optional data transition animation applied when new data arrives.
Public Signals Documentation¶
signal barOffsetChanged¶
Emitted when the barOffset property changes.
signal barWidthChanged¶
Emitted when the barWidth property changes.
signal baselineValueChanged¶
Emitted when the baselineValue property changes.
signal categoriesChanged¶
Emitted when a category is added, removed, or edited.
signal colorChanged¶
Emitted when the color property changes.
signal colorSourceChanged¶
Emitted when the colorSource property changes.
signal hoverColorChanged¶
Emitted when the hoverColor property changes.
signal hoveredIndexChanged¶
Emitted when the hovered bar index changes.
signal minimumWidthChanged¶
Emitted when the minimumWidth property changes.
signal orientationChanged¶
Emitted when the orientation property changes.
signal transitionChanged¶
Emitted when the transition property changes.
Public Functions Documentation¶
function BarSeries¶
Constructs a BarSeries with the given__parent .
function barAt¶
Returns bar index as an object withposition andvalue , orfrom ,to , andvalue for a ranged bar.
Includes category when the bars have categories, and categoryName when that category has a name. Returns an empty object when index is out of range.
function barIndexAt¶
Returns the index of the topmost bar under item position position , or -1.
function barOffset¶
Returns the shift of every bar along the position axis in data units.
function barWidth¶
Returns the bar width in position-axis data units.
function baselineValue¶
Returns the value the bars start from.
function border¶
Returns the grouped outline settings. The object is owned by the series.
function categories¶
Returns the categories as a QML list.
function clearData¶
Removes all bars.
Implements QAccelPlot::PlotSeries::clearData
function color¶
Returns the bar fill color.
function colorSource¶
Returns what the colormap maps to a bar's color.
function contains¶
Returns true when a bar lies under item position__point .
Hover delivery uses this test, so stacked series underneath still receive hover events outside the bars.
function hoverColor¶
Returns the fill color of the hovered bar.
function hoveredIndex¶
Returns the index of the hovered bar, or -1 if none.
function legendEntries¶
Returns one legend entry per category, or the legendEntry() when there are no categories or acolormap is assigned.
Implements QAccelPlot::PlotSeries::legendEntries
function legendEntry¶
Returns the legend entry: the symbol and color of the bars.
Implements QAccelPlot::PlotSeries::legendEntry
function minimumWidth¶
Returns the minimum drawn bar width in pixels.
function orientation¶
Returns the direction the bars grow in.
function postData¶
Thread-safe: queues setData _(_data _,_categories _,_barCount ) to the item's thread.
void QAccelPlot::BarSeries::postData (
std::vector< double > && data,
std::vector< int > && categories,
int barCount
)
function postData¶
Thread-safe: queues setDataF _(_data _,_categories _,_barCount ) to the item's thread.
void QAccelPlot::BarSeries::postData (
std::vector< float > && data,
std::vector< int > && categories,
int barCount
)
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 postRangedData¶
Thread-safe: queues setRangedData _(_data _,_barCount ) to the item's thread.
function setBarOffset¶
Sets the shift of every bar along the position axis to offset data units.
function setBarWidth¶
Sets the bar width to width data units. Negative values are clamped to 0.
function setBaselineValue¶
Sets the value the bars start from to baselineValue . NaN is ignored.
function setCategories¶
Replaces the categories with categories . The series does not take ownership.
function setColor¶
Sets the fill color to color .
function setColorSource¶
Sets what the colormap maps to a bar's color to source .
function setData¶
Loads bars from bars , a QML list of numbers or objects.
A number is the value of a bar at position = its list index. An object has position, value, and an optional category: a category value or name, with names resolved against categories now. A missing position is the list index; a missing value is NaN. Any other category is ignored with a warning.
When any object has from or to, all bars are ranged: each object has from, to, value, and an optional category, and a missing from or to is NaN.
function setData¶
Moves data and per-bar category values__categories (empty, or exactly__barCount ) into the series.
void QAccelPlot::BarSeries::setData (
std::vector< double > && data,
std::vector< int > && categories,
int barCount
)
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::BarSeries::setData (
std::vector< double > && data,
int count,
const DataBounds & bounds
)
function setDataF¶
Like setDataF _(_data _,_barCount ) and also moves per-bar category values__categories (empty, or exactly__barCount ) into the series.
void QAccelPlot::BarSeries::setDataF (
std::vector< float > && data,
std::vector< int > && categories,
int barCount
)
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::BarSeries::setDataF (
std::vector< float > && data,
int count,
const DataBounds & bounds
)
function setDataPointCategories¶
Sets one category per bar, each a category value orname .
An empty list clears them; any other size must equal count. Other values leave their bar without a category and log a warning.
function setHoverColor¶
Sets the fill color of the hovered bar to color . An invalid color disables the highlight.
function setMinimumWidth¶
Sets the minimum drawn bar width to width pixels. Negative values are clamped to 0.
function setOrientation¶
Sets the direction the bars grow in to orientation .
function setRangedData¶
Moves ranged bars into the series: data holds__barCount × 3 doubles (from, to, value). Clears categories.
function setRangedData¶
Like setRangedData _(_data _,_barCount ) and also moves per-bar category values__categories (empty, or exactly__barCount ) into the series.
void QAccelPlot::BarSeries::setRangedData (
std::vector< double > && data,
std::vector< int > && categories,
int barCount
)
function setTransition¶
Sets the data transition to transition .
function transition¶
Returns the active data transition, or nullptr if none.
function ~BarSeries¶
Destroys the series, ending its animation on the assigned transition.
Protected Functions Documentation¶
function applyDataPoints¶
Applies new (position, value) bars, animating to them when a transition is enabled.
Implements QAccelPlot::PlotSeries::applyDataPoints
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.
Implements QAccelPlot::PlotSeries::computeDataRanges
function dataPointValueCount¶
Returns 2: setData() andsetDataF() take (position, value) bars, whatever the current layout.
Implements QAccelPlot::PlotSeries::dataPointValueCount
function hoverEnterEvent¶
function hoverLeaveEvent¶
function hoverMoveEvent¶
function inspectionRecord¶
Returns the bar at index with its position, value, and category.
Implements QAccelPlot::PlotSeries::inspectionRecord
function inspectionRecordAt¶
Returns the bar drawn at the series-local position .
virtual InspectionRecord QAccelPlot::BarSeries::inspectionRecordAt (
const QPointF & position
) override const
Implements QAccelPlot::PlotSeries::inspectionRecordAt
function onAxisScaleChanged¶
Repaints with the coordinates mapped for the new scale.
Implements QAccelPlot::PlotSeries::onAxisScaleChanged
function onDataPointsChanged¶
Refreshes the vertices, the hover index, the count, and the value range after the bars changed.
virtual void QAccelPlot::BarSeries::onDataPointsChanged (
DataChange change,
int previousCount
) override
Implements QAccelPlot::PlotSeries::onDataPointsChanged
function recordInspectionSupported¶
Returns true: bars are inspected as records.
Implements QAccelPlot::PlotSeries::recordInspectionSupported
function scanValueRange¶
Returns the span of the finite colorSource values while a colormap is assigned.
Ranged bars contribute both edges for Position.
Implements QAccelPlot::ColormappedSeries::scanValueRange
function updatePaintNode¶
QSGNode * QAccelPlot::BarSeries::updatePaintNode (
QSGNode * oldNode,
UpdatePaintNodeData *
) override
The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/series/BarSeries.hpp