QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
QwtPlotAbstractBarChart Class Reference

Abstract base class for bar chart items. More...

#include <qwt_plot_abstract_barchart.h>

Inheritance diagram for QwtPlotAbstractBarChart:
QwtPlotSeriesItem QwtPlotItem QwtAbstractSeriesStore QwtPlotBarChart QwtPlotMultiBarChart

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.
 
QwtPlotplot () 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 QwtTexttitle () 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< QwtLegendDatalegendData () 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
 

Detailed Description

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.

Member Enumeration Documentation

◆ LayoutPolicy

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.

See also
boundingRectangle()
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.

See also
boundingRectangle()
FixedSampleSize 

layoutHint() defines a fixed width in paint device coordinates.

Constructor & Destructor Documentation

◆ QwtPlotAbstractBarChart()

QwtPlotAbstractBarChart::QwtPlotAbstractBarChart ( const QwtText title)
explicit

Constructor.

Parameters
[in]titleTitle of the chart

Destructor

Member Function Documentation

◆ baseline()

double QwtPlotAbstractBarChart::baseline ( ) const

Get the baseline value.

Returns
Value for the origin of the bar chart
See also
setBaseline(), QwtPlotSeriesItem::orientation()

◆ getCanvasMarginHint()

void QwtPlotAbstractBarChart::getCanvasMarginHint ( const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  canvasRect,
double &  left,
double &  top,
double &  right,
double &  bottom 
) const
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 ).

Parameters
[in]xMapMaps x-values into pixel coordinates.
[in]yMapMaps y-values into pixel coordinates.
[in]canvasRectContents rectangle of the canvas in painter coordinates
[out]leftReturns the left margin
[out]topReturns the top margin
[out]rightReturns the right margin
[out]bottomReturns the bottom margin
See also
layoutPolicy(), layoutHint(), QwtPlotItem::Margins, QwtPlot::getCanvasMarginsHint(), QwtPlot::updateCanvasMargins()

Reimplemented from QwtPlotItem.

◆ layoutHint()

double QwtPlotAbstractBarChart::layoutHint ( ) const

Get the layout hint.

The combination of layoutPolicy() and layoutHint() define how the width of the bars is calculated.

Returns
Layout hint of the chart item
See also
LayoutPolicy, setLayoutHint(), layoutPolicy()

◆ layoutPolicy()

QwtPlotAbstractBarChart::LayoutPolicy QwtPlotAbstractBarChart::layoutPolicy ( ) const

Get the layout policy.

The combination of layoutPolicy() and layoutHint() define how the width of the bars is calculated.

Returns
Layout policy of the chart item
See also
setLayoutPolicy(), layoutHint()

◆ margin()

int QwtPlotAbstractBarChart::margin ( ) const

Get the margin around the bars.

Returns
Margin between the outmost bars and the contentsRect() of the canvas.
See also
setMargin(), spacing()

◆ sampleWidth()

double QwtPlotAbstractBarChart::sampleWidth ( const QwtScaleMap map,
double  canvasSize,
double  boundingSize,
double  value 
) const
protected

Calculate the width for a sample in paint device coordinates.

Parameters
mapScale map for the corresponding scale
canvasSizeSize of the canvas in paint device coordinates
boundingSizeBounding size of the chart in plot coordinates ( used in AutoAdjustSamples mode )
valueValue of the sample
Returns
Sample width
See also
layoutPolicy(), layoutHint()

◆ setBaseline()

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.

Parameters
[in]valueValue for the baseline
See also
baseline(), QwtPlotSeriesItem::orientation()

◆ setLayoutHint()

void QwtPlotAbstractBarChart::setLayoutHint ( double  hint)

Set the layout hint.

The combination of layoutPolicy() and layoutHint() define how the width of the bars is calculated.

Parameters
[in]hintLayout hint
See also
LayoutPolicy, layoutPolicy(), layoutHint()

◆ setLayoutPolicy()

void QwtPlotAbstractBarChart::setLayoutPolicy ( LayoutPolicy  policy)

Set the layout policy.

The combination of layoutPolicy() and layoutHint() define how the width of the bars is calculated.

Parameters
[in]policyLayout policy
See also
layoutPolicy(), layoutHint()

◆ setMargin()

void QwtPlotAbstractBarChart::setMargin ( int  margin)

Set the margin around the bars.

The margin is the distance between the outmost bars and the contentsRect() of the canvas. The default setting is 5 pixels.

Parameters
[in]marginMargin in pixels
See also
spacing(), margin()

◆ setSpacing()

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.

Parameters
[in]spacingSpacing in pixels
See also
spacing()

◆ spacing()

int QwtPlotAbstractBarChart::spacing ( ) const

Get the spacing between bars.

Returns
Spacing between 2 samples ( bars or groups of bars )
See also
setSpacing(), margin()

The documentation for this class was generated from the following files: