|
QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
|
Abstract base class for bar chart items. More...
#include <qwt_plot_abstract_barchart.h>
Classes | |
| class | PrivateData |
Public Types | |
| enum | LayoutPolicy { AutoAdjustSamples , ScaleSamplesToAxes , ScaleSampleToCanvas , FixedSampleSize } |
| Mode how to calculate the bar width. More... | |
Public Types inherited from QwtPlotItem | |
| enum | RttiValues { Rtti_PlotItem = 0 , Rtti_PlotGrid , Rtti_PlotScale , Rtti_PlotLegend , Rtti_PlotMarker , Rtti_PlotCurve , Rtti_PlotSpectroCurve , Rtti_PlotIntervalCurve , Rtti_PlotHistogram , Rtti_PlotSpectrogram , Rtti_PlotGraphic , Rtti_PlotTradingCurve , Rtti_PlotBarChart , Rtti_PlotMultiBarChart , Rtti_PlotShape , Rtti_PlotTextLabel , Rtti_PlotZone , Rtti_PlotVectorField , Rtti_PlotArrowMarker , Rtti_PlotBoxChart , Rtti_PlotUserItem = 1000 } |
| Runtime type information. More... | |
| enum | ItemAttribute { Legend = 0x01 , AutoScale = 0x02 , Margins = 0x04 } |
| Plot Item Attributes. More... | |
| enum | ItemInterest { ScaleInterest = 0x01 , LegendInterest = 0x02 } |
| Plot Item Interests. More... | |
| enum | RenderHint { RenderAntialiased = 0x1 } |
| Render hints. More... | |
Public Member Functions | |
| QwtPlotAbstractBarChart (const QwtText &title) | |
| Constructor. | |
| void | setLayoutPolicy (LayoutPolicy) |
| Set the layout policy. | |
| LayoutPolicy | layoutPolicy () const |
| Get the layout policy. | |
| void | setLayoutHint (double) |
| Set the layout hint. | |
| double | layoutHint () const |
| Get the layout hint. | |
| void | setSpacing (int) |
| Set the spacing between bars. | |
| int | spacing () const |
| Get the spacing between bars. | |
| void | setMargin (int) |
| Set the margin around the bars. | |
| int | margin () const |
| Get the margin around the bars. | |
| void | setBaseline (double) |
| Set the baseline value. | |
| double | baseline () const |
| Get the baseline value. | |
| virtual void | getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const override |
| Calculate a hint for the canvas margin. | |
Public Member Functions inherited from QwtPlotSeriesItem | |
| QwtPlotSeriesItem (const QString &title=QString()) | |
| QwtPlotSeriesItem (const QwtText &title) | |
| Constructor. | |
| void | setOrientation (Qt::Orientation) |
| Set the orientation of the item. | |
| Qt::Orientation | orientation () const |
| Get the orientation of the plot item. | |
| virtual void | draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override |
| Draw the complete series. | |
| virtual void | drawSeries (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0 |
| Draw a subset of the samples. | |
| virtual QRectF | boundingRect () const override |
| Get the bounding rectangle. | |
| virtual void | updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) override |
| Update the scale divisions. | |
Public Member Functions inherited from QwtPlotItem | |
| QwtPlotItem () | |
| Default constructor. | |
| QwtPlotItem (const QString &title) | |
| Constructor with title as QString. | |
| QwtPlotItem (const QwtText &title) | |
| Constructor with title as QwtText. | |
| virtual | ~QwtPlotItem () |
| Destructor. | |
| virtual void | attach (QwtPlot *plot) |
| Attach the item to a plot. | |
| void | detach () |
| Detach the item from the plot. | |
| QwtPlot * | plot () const |
| Get the plot the item is attached to. | |
| void | setTitle (const QString &title) |
| Set the title using a QString. | |
| void | setTitle (const QwtText &title) |
| Set the title using a QwtText. | |
| const QwtText & | title () const |
| Get the title. | |
| virtual int | rtti () const |
| Runtime type information. | |
| void | setItemAttribute (ItemAttribute, bool on=true) |
| Set an item attribute. | |
| bool | testItemAttribute (ItemAttribute) const |
| Test an item attribute. | |
| void | setItemInterest (ItemInterest, bool on=true) |
| Set an item interest. | |
| bool | testItemInterest (ItemInterest) const |
| Test an item interest. | |
| void | setRenderHint (RenderHint, bool on=true) |
| Set a render hint. | |
| bool | testRenderHint (RenderHint) const |
| Test a render hint. | |
| void | setRenderThreadCount (uint numThreads) |
| Set the number of render threads. | |
| uint | renderThreadCount () const |
| Get the number of render threads. | |
| void | setLegendIconSize (const QSize &) |
| Set the legend icon size. | |
| QSize | legendIconSize () const |
| Get the legend icon size. | |
| double | z () const |
| Get the z-value. | |
| void | setZ (double z) |
| Set the z-value. | |
| void | show () |
| Show the item. | |
| void | hide () |
| Hide the item. | |
| virtual void | setVisible (bool) |
| Set the visibility. | |
| bool | isVisible () const |
| Check if the item is visible. | |
| void | setAxes (QwtAxisId xAxis, QwtAxisId yAxis) |
| Set both axes. | |
| void | setXAxis (QwtAxisId) |
| Set the x-axis. | |
| QwtAxisId | xAxis () const |
| Get the x-axis. | |
| void | setYAxis (QwtAxisId) |
| Set the y-axis. | |
| QwtAxisId | yAxis () const |
| Get the y-axis. | |
| virtual void | itemChanged () |
| Notify the plot that the item has changed. | |
| virtual void | legendChanged () |
| Notify the item that the legend has changed. | |
| virtual void | updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &) |
| Update the item with changes of the legend. | |
| QRectF | scaleRect (const QwtScaleMap &, const QwtScaleMap &) const |
| Calculate the scale rectangle. | |
| QRectF | paintRect (const QwtScaleMap &, const QwtScaleMap &) const |
| Calculate the paint rectangle. | |
| virtual QList< QwtLegendData > | legendData () const |
| Return legend data. | |
| virtual QwtGraphic | legendIcon (int index, const QSizeF &) const |
| Return a legend icon. | |
Protected Member Functions | |
| double | sampleWidth (const QwtScaleMap &map, double canvasSize, double boundingSize, double value) const |
| Calculate the width for a sample in paint device coordinates. | |
Protected Member Functions inherited from QwtPlotSeriesItem | |
| virtual void | dataChanged () override |
| dataChanged() indicates, that the series has been changed. | |
Protected Member Functions inherited from QwtPlotItem | |
| QwtGraphic | defaultIcon (const QBrush &, const QSizeF &) const |
| Create a default icon. | |
Protected Member Functions inherited from QwtAbstractSeriesStore | |
| virtual void | setRectOfInterest (const QRectF &)=0 |
| Set a the "rectangle of interest" for the stored series. | |
| virtual QRectF | dataRect () const =0 |
| virtual size_t | dataSize () const =0 |
Abstract base class for bar chart items.
In opposite to almost all other plot items bar charts can't be displayed inside of their bounding rectangle and need a special API how to calculate the width of the bars and how they affect the layout of the attached plot.
Mode how to calculate the bar width.
setLayoutPolicy(), setLayoutHint(), barWidthHint()
| Enumerator | |
|---|---|
| AutoAdjustSamples | The sample width is calculated by dividing the bounding rectangle by the number of samples. The layoutHint() is used as a minimum width in paint device coordinates.
|
| ScaleSamplesToAxes | layoutHint() defines an interval in axis coordinates |
| ScaleSampleToCanvas | The bar width is calculated by multiplying layoutHint() with the height or width of the canvas.
|
| FixedSampleSize | layoutHint() defines a fixed width in paint device coordinates. |
|
explicit |
Constructor.
| [in] | title | Title of the chart |
Destructor
| double QwtPlotAbstractBarChart::baseline | ( | ) | const |
Get the baseline value.
|
overridevirtual |
Calculate a hint for the canvas margin.
Bar charts need to reserve some space for displaying the bars for the first and the last sample. The hint is calculated from the layoutHint() depending on the layoutPolicy(). The margins are in target device coordinates ( pixels on screen ).
| [in] | xMap | Maps x-values into pixel coordinates. |
| [in] | yMap | Maps y-values into pixel coordinates. |
| [in] | canvasRect | Contents rectangle of the canvas in painter coordinates |
| [out] | left | Returns the left margin |
| [out] | top | Returns the top margin |
| [out] | right | Returns the right margin |
| [out] | bottom | Returns the bottom margin |
Reimplemented from QwtPlotItem.
| double QwtPlotAbstractBarChart::layoutHint | ( | ) | const |
Get the layout hint.
The combination of layoutPolicy() and layoutHint() define how the width of the bars is calculated.
| QwtPlotAbstractBarChart::LayoutPolicy QwtPlotAbstractBarChart::layoutPolicy | ( | ) | const |
Get the layout policy.
The combination of layoutPolicy() and layoutHint() define how the width of the bars is calculated.
| int QwtPlotAbstractBarChart::margin | ( | ) | const |
Get the margin around the bars.
|
protected |
Calculate the width for a sample in paint device coordinates.
| map | Scale map for the corresponding scale |
| canvasSize | Size of the canvas in paint device coordinates |
| boundingSize | Bounding size of the chart in plot coordinates ( used in AutoAdjustSamples mode ) |
| value | Value of the sample |
| void QwtPlotAbstractBarChart::setBaseline | ( | double | value | ) |
Set the baseline value.
The baseline is the origin for the chart. Each bar is painted from the baseline in the direction of the sample value. In case of a horizontal orientation() the baseline is interpreted as x - otherwise as y - value. The default value for the baseline is 0.
| [in] | value | Value for the baseline |
| void QwtPlotAbstractBarChart::setLayoutHint | ( | double | hint | ) |
Set the layout hint.
The combination of layoutPolicy() and layoutHint() define how the width of the bars is calculated.
| [in] | hint | Layout hint |
| void QwtPlotAbstractBarChart::setLayoutPolicy | ( | LayoutPolicy | policy | ) |
Set the layout policy.
The combination of layoutPolicy() and layoutHint() define how the width of the bars is calculated.
| [in] | policy | Layout policy |
| void QwtPlotAbstractBarChart::setMargin | ( | int | margin | ) |
| void QwtPlotAbstractBarChart::setSpacing | ( | int | spacing | ) |
Set the spacing between bars.
The spacing is the distance between 2 samples ( bars for QwtPlotBarChart or a group of bars for QwtPlotMultiBarChart ) in paint device coordinates.
| [in] | spacing | Spacing in pixels |
| int QwtPlotAbstractBarChart::spacing | ( | ) | const |
Get the spacing between bars.