QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| Public 类型 | Public 成员函数 | Protected 成员函数 | 所有成员列表
QwtPlotMultiBarChart类 参考

QwtPlotMultiBarChart displays a series of samples that consist each of a set of values 更多...

#include <qwt_plot_multi_barchart.h>

类 QwtPlotMultiBarChart 继承关系图:
QwtPlotAbstractBarChart QwtSeriesStore< QwtSetSample > QwtPlotSeriesItem QwtAbstractSeriesStore QwtPlotItem QwtAbstractSeriesStore

class  PrivateData
 

Public 类型

enum  ChartStyle { Grouped , Stacked }
 Chart styles 更多...
 
- Public 类型 继承自 QwtPlotAbstractBarChart
enum  LayoutPolicy { AutoAdjustSamples , ScaleSamplesToAxes , ScaleSampleToCanvas , FixedSampleSize }
 Mode how to calculate the bar width 更多...
 
- Public 类型 继承自 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 更多...
 
enum  ItemAttribute { Legend = 0x01 , AutoScale = 0x02 , Margins = 0x04 }
 Plot Item Attributes 更多...
 
enum  ItemInterest { ScaleInterest = 0x01 , LegendInterest = 0x02 }
 Plot Item Interests 更多...
 
enum  RenderHint { RenderAntialiased = 0x1 }
 Render hints 更多...
 

Public 成员函数

 QwtPlotMultiBarChart (const QString &title=QString())
 Constructor
 
 QwtPlotMultiBarChart (const QwtText &title)
 Constructor with title
 
 ~QwtPlotMultiBarChart () override
 Destructor
 
virtual int rtti () const override
 Get the runtime type information
 
void attach (QwtPlot *plot) override
 Attach to a plot (applies color cycle to symbols if none user-set)
 
void setBarTitles (const QList< QwtText > &)
 Set the bar titles
 
QList< QwtTextbarTitles () const
 Get the bar titles
 
void setSamples (const QVector< QwtSetSample > &)
 Set samples from a vector of QwtSetSample
 
void setSamples (const QVector< QVector< double > > &)
 Set samples from a vector of vectors
 
void setSamples (QwtSeriesData< QwtSetSample > *)
 Set samples from a series data
 
void setStyle (ChartStyle style)
 Set the chart style
 
ChartStyle style () const
 Get the chart style
 
void setSymbol (int valueIndex, QwtColumnSymbol *)
 Set the symbol for a specific value index
 
const QwtColumnSymbolsymbol (int valueIndex) const
 Get the symbol for a specific value index
 
void resetSymbolMap ()
 Reset the symbol map
 
virtual void drawSeries (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const override
 Draw the series
 
virtual QRectF boundingRect () const override
 Get the bounding rectangle
 
virtual QList< QwtLegendDatalegendData () const override
 Get the legend data
 
virtual QwtGraphic legendIcon (int index, const QSizeF &) const override
 Get the legend icon
 
- Public 成员函数 继承自 QwtPlotAbstractBarChart
 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 成员函数 继承自 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 updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) override
 Update the scale divisions
 
- Public 成员函数 继承自 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
 
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
 
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
 
- Public 成员函数 继承自 QwtSeriesStore< QwtSetSample >
void setData (QwtSeriesData< QwtSetSample > *series)
 
QwtSeriesData< QwtSetSample > * data ()
 
const QwtSeriesData< QwtSetSample > * data () const
 
QwtSetSample sample (size_t index) const
 
virtual size_t dataSize () const override
 
virtual QRectF dataRect () const override
 
virtual void setRectOfInterest (const QRectF &rect) override
 Set a the "rectangle of interest" for the stored series
 
QwtSeriesData< QwtSetSample > * swapData (QwtSeriesData< QwtSetSample > *series)
 

Protected 成员函数

QwtColumnSymbolsymbol (int valueIndex)
 Get the symbol for a specific value index
 
virtual QwtColumnSymbolspecialSymbol (int sampleIndex, int valueIndex) const
 Get a special symbol for a specific sample and value index
 
virtual void drawSample (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, const QwtInterval &boundingInterval, int index, const QwtSetSample &) const
 Draw a sample
 
virtual void drawBar (QPainter *, int sampleIndex, int valueIndex, const QwtColumnRect &) const
 Draw a bar
 
void drawStackedBars (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int index, double sampleWidth, const QwtSetSample &) const
 Draw stacked bars
 
void drawGroupedBars (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int index, double sampleWidth, const QwtSetSample &) const
 Draw grouped bars
 
- Protected 成员函数 继承自 QwtPlotAbstractBarChart
double sampleWidth (const QwtScaleMap &map, double canvasSize, double boundingSize, double value) const
 Calculate the width for a sample in paint device coordinates
 
- Protected 成员函数 继承自 QwtPlotSeriesItem
virtual void dataChanged () override
 dataChanged() indicates, that the series has been changed.
 
- Protected 成员函数 继承自 QwtPlotItem
QwtGraphic defaultIcon (const QBrush &, const QSizeF &) const
 Create a default icon
 

详细描述

QwtPlotMultiBarChart displays a series of samples that consist each of a set of values

Each value is displayed as a bar, the bars of each set can be organized side by side or accumulated.

Each bar of a set is rendered by a QwtColumnSymbol, that is set by setSymbol(). The bars of different sets use the same symbols. Exceptions are possible by overloading specialSymbol() or overloading drawBar().

Depending on its orientation() the bars are displayed horizontally or vertically. The bars cover the interval between the baseline() and the value.

In opposite to most other plot items, QwtPlotMultiBarChart returns more than one entry for the legend - one for each symbol.

参见
QwtPlotBarChart, QwtPlotHistogram
QwtPlotSeriesItem::orientation(), QwtPlotAbstractBarChart::baseline()

成员枚举类型说明

◆ ChartStyle

Chart styles

The default setting is QwtPlotMultiBarChart::Grouped.

参见
setStyle(), style()
枚举值
Grouped 

The bars of a set are displayed side by side

Stacked 

The bars are displayed on top of each other accumulating to a single bar. All values of a set need to have the same sign.

构造及析构函数说明

◆ QwtPlotMultiBarChart()

QwtPlotMultiBarChart::QwtPlotMultiBarChart ( const QwtText title)
explicit

Constructor with title

Constructor

参数
[in]titleTitle of the chart

Constructor

参数
[in]titleTitle of the chart

Destructor

成员函数说明

◆ attach()

void QwtPlotMultiBarChart::attach ( QwtPlot plot)
overridevirtual

Attach to a plot (applies color cycle to symbols if none user-set)

Attach the multi bar chart to a plot

If no symbols have been set by the user, the chart automatically creates colored symbols from the plot's color cycle. The number of value indices is determined from the first sample.

参数
plotPlot to attach to (nullptr to detach)

重载 QwtPlotItem .

◆ barTitles()

QList< QwtText > QwtPlotMultiBarChart::barTitles ( ) const

Get the bar titles

返回
Bar titles
参见
setBarTitles(), legendData()

◆ boundingRect()

QRectF QwtPlotMultiBarChart::boundingRect ( ) const
overridevirtual

Get the bounding rectangle

Get the bounding rectangle of all samples

返回
Bounding rectangle of all samples. For an empty series the rectangle is invalid.

重载 QwtPlotSeriesItem .

◆ drawBar()

void QwtPlotMultiBarChart::drawBar ( QPainter *  painter,
int  sampleIndex,
int  valueIndex,
const QwtColumnRect rect 
) const
protectedvirtual

Draw a bar

参数
painterPainter
sampleIndexIndex of the sample - might be -1 when the bar is painted for the legend
valueIndexIndex of a value in a set
rectDirected target rectangle for the bar
参见
drawSeries()

◆ drawGroupedBars()

void QwtPlotMultiBarChart::drawGroupedBars ( QPainter *  painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  canvasRect,
int  index,
double  sampleWidth,
const QwtSetSample sample 
) const
protected

Draw grouped bars

Draw a grouped sample

参数
painterPainter
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
indexIndex of the sample to be painted
sampleWidthBounding width for all bars of the sample
sampleSample
参见
drawSeries(), sampleWidth()

◆ drawSample()

void QwtPlotMultiBarChart::drawSample ( QPainter *  painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  canvasRect,
const QwtInterval boundingInterval,
int  index,
const QwtSetSample sample 
) const
protectedvirtual

Draw a sample

参数
painterPainter
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
boundingIntervalBounding interval of sample values
indexIndex of the sample to be painted
sampleSample value
参见
drawSeries()

◆ drawSeries()

void QwtPlotMultiBarChart::drawSeries ( QPainter *  painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  canvasRect,
int  from,
int  to 
) const
overridevirtual

Draw the series

Draw an interval of the bar chart

参数
[in]painterPainter
[in]xMapMaps x-values into pixel coordinates
[in]yMapMaps y-values into pixel coordinates
[in]canvasRectContents rectangle of the canvas
[in]fromIndex of the first point to be painted
[in]toIndex of the last point to be painted. If to < 0, the curve will be painted to its last point.
参见
drawSample()

实现了 QwtPlotSeriesItem.

◆ drawStackedBars()

void QwtPlotMultiBarChart::drawStackedBars ( QPainter *  painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  canvasRect,
int  index,
double  sampleWidth,
const QwtSetSample sample 
) const
protected

Draw stacked bars

Draw a stacked sample

参数
painterPainter
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
indexIndex of the sample to be painted
sampleWidthWidth of the bars
sampleSample
参见
drawSeries(), sampleWidth()

◆ legendData()

QList< QwtLegendData > QwtPlotMultiBarChart::legendData ( ) const
overridevirtual

Get the legend data

Get information to be displayed on the legend

The chart is represented by a list of entries - one for each bar title. Each element contains a bar title and an icon showing its corresponding bar.

返回
List of legend data entries
参见
barTitles(), legendIcon(), legendIconSize()

重载 QwtPlotItem .

◆ legendIcon()

QwtGraphic QwtPlotMultiBarChart::legendIcon ( int  index,
const QSizeF &  size 
) const
overridevirtual

Get the legend icon

Get icon for representing a bar on the legend

参数
[in]indexIndex of the bar
[in]sizeIcon size
返回
An icon showing a bar
参见
drawBar(), legendData()

重载 QwtPlotItem .

◆ resetSymbolMap()

void QwtPlotMultiBarChart::resetSymbolMap ( )

Reset the symbol map

Remove all symbols from the symbol map

◆ rtti()

int QwtPlotMultiBarChart::rtti ( ) const
overridevirtual

Get the runtime type information

返回
QwtPlotItem::Rtti_PlotMultiBarChart

重载 QwtPlotItem .

◆ setBarTitles()

void QwtPlotMultiBarChart::setBarTitles ( const QList< QwtText > &  titles)

Set the bar titles

Set the titles for the bars

The titles are used for the legend.

参数
[in]titlesBar titles
参见
barTitles(), legendData()

◆ setSamples() [1/3]

void QwtPlotMultiBarChart::setSamples ( const QVector< QVector< double > > &  samples)

Set samples from a vector of vectors

Initialize data with an array of samples

参数
[in]samplesVector of vectors containing values

◆ setSamples() [2/3]

void QwtPlotMultiBarChart::setSamples ( const QVector< QwtSetSample > &  samples)

Set samples from a vector of QwtSetSample

Initialize data with an array of samples

参数
[in]samplesVector of samples

◆ setSamples() [3/3]

void QwtPlotMultiBarChart::setSamples ( QwtSeriesData< QwtSetSample > *  data)

Set samples from a series data

Assign a series of samples

setSamples() is just a wrapper for setData() without any additional value - beside that it is easier to find for the developer.

参数
[in]dataData
警告
The item takes ownership of the data object, deleting it when its not used anymore.

◆ setStyle()

void QwtPlotMultiBarChart::setStyle ( ChartStyle  style)

Set the chart style

Set the style of the chart

参数
[in]styleChart style
参见
style()

◆ setSymbol()

void QwtPlotMultiBarChart::setSymbol ( int  valueIndex,
QwtColumnSymbol symbol 
)

Set the symbol for a specific value index

Add a symbol to the symbol map

Assign a default symbol for drawing the bar representing all values with the same index in a set.

参数
[in]valueIndexIndex of a value in a set
[in]symbolSymbol used for drawing a bar
参见
symbol(), resetSymbolMap(), specialSymbol()

◆ specialSymbol()

QwtColumnSymbol * QwtPlotMultiBarChart::specialSymbol ( int  sampleIndex,
int  valueIndex 
) const
protectedvirtual

Get a special symbol for a specific sample and value index

Create a symbol for special values

Usually the symbols for displaying a bar are set by setSymbols() and common for all sets. By overloading specialSymbol() it is possible to create a temporary symbol() for displaying a special value.

The symbol has to be created by new each time specialSymbol() is called. As soon as the symbol is painted this symbol gets deleted.

When no symbol ( nullptr ) is returned, the value will be displayed with the standard symbol that is used for all symbols with the same valueIndex.

参数
sampleIndexIndex of the sample
valueIndexIndex of the value in the set
返回
nullptr, meaning that the value is not special

◆ style()

QwtPlotMultiBarChart::ChartStyle QwtPlotMultiBarChart::style ( ) const

Get the chart style

Get the style of the chart

返回
Style of the chart
参见
setStyle()

◆ symbol() [1/2]

QwtColumnSymbol * QwtPlotMultiBarChart::symbol ( int  valueIndex)
protected

Get the symbol for a specific value index

Find a symbol in the symbol map

参数
valueIndexIndex of a value in a set
返回
The symbol, that had been set by setSymbol() or nullptr.
参见
setSymbol(), specialSymbol(), drawBar()

◆ symbol() [2/2]

const QwtColumnSymbol * QwtPlotMultiBarChart::symbol ( int  valueIndex) const

Get the symbol for a specific value index

Find a symbol in the symbol map

参数
[in]valueIndexIndex of a value in a set
返回
The symbol that had been set by setSymbol() or nullptr
参见
setSymbol(), specialSymbol(), drawBar()

该类的文档由以下文件生成: