source: ntrip/trunk/BNC/qwt/qwt_plot_multi_barchart.h@ 10265

Last change on this file since 10265 was 9383, checked in by stoecker, 4 years ago

update to qwt verion 6.1.1 to fix build with newer Qt5

File size: 3.9 KB
Line 
1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#ifndef QWT_PLOT_MULTI_BAR_CHART_H
11#define QWT_PLOT_MULTI_BAR_CHART_H
12
13#include "qwt_global.h"
14#include "qwt_plot_abstract_barchart.h"
15#include "qwt_series_data.h"
16
17class QwtColumnRect;
18class QwtColumnSymbol;
19
20/*!
21 \brief QwtPlotMultiBarChart displays a series of a samples that consist
22 each of a set of values.
23
24 Each value is displayed as a bar, the bars of each set can be organized
25 side by side or accumulated.
26
27 Each bar of a set is rendered by a QwtColumnSymbol, that is set by setSymbol().
28 The bars of different sets use the same symbols. Exceptions are possible
29 by overloading specialSymbol() or overloading drawBar().
30
31 Depending on its orientation() the bars are displayed horizontally
32 or vertically. The bars cover the interval between the baseline()
33 and the value.
34
35 In opposite to most other plot items, QwtPlotMultiBarChart returns more
36 than one entry for the legend - one for each symbol.
37
38 \sa QwtPlotBarChart, QwtPlotHistogram
39 QwtPlotSeriesItem::orientation(), QwtPlotAbstractBarChart::baseline()
40 */
41class QWT_EXPORT QwtPlotMultiBarChart:
42 public QwtPlotAbstractBarChart, public QwtSeriesStore<QwtSetSample>
43{
44public:
45 /*!
46 \brief Chart styles.
47
48 The default setting is QwtPlotMultiBarChart::Grouped.
49 \sa setStyle(), style()
50 */
51 enum ChartStyle
52 {
53 //! The bars of a set are displayed side by side
54 Grouped,
55
56 /*!
57 The bars are displayed on top of each other accumulating
58 to a single bar. All values of a set need to have the same
59 sign.
60 */
61 Stacked
62 };
63
64 explicit QwtPlotMultiBarChart( const QString &title = QString() );
65 explicit QwtPlotMultiBarChart( const QwtText &title );
66
67 virtual ~QwtPlotMultiBarChart();
68
69 virtual int rtti() const;
70
71 void setBarTitles( const QList<QwtText> & );
72 QList<QwtText> barTitles() const;
73
74 void setSamples( const QVector<QwtSetSample> & );
75 void setSamples( const QVector< QVector<double> > & );
76 void setSamples( QwtSeriesData<QwtSetSample> * );
77
78 void setStyle( ChartStyle style );
79 ChartStyle style() const;
80
81 void setSymbol( int valueIndex, QwtColumnSymbol * );
82 const QwtColumnSymbol *symbol( int valueIndex ) const;
83
84 void resetSymbolMap();
85
86 virtual void drawSeries( QPainter *painter,
87 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
88 const QRectF &canvasRect, int from, int to ) const;
89
90 virtual QRectF boundingRect() const;
91
92 virtual QList<QwtLegendData> legendData() const;
93
94 virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
95
96protected:
97 QwtColumnSymbol *symbol( int valueIndex );
98
99 virtual QwtColumnSymbol *specialSymbol(
100 int sampleIndex, int valueIndex ) const;
101
102 virtual void drawSample( QPainter *painter,
103 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
104 const QRectF &canvasRect, const QwtInterval &boundingInterval,
105 int index, const QwtSetSample& sample ) const;
106
107 virtual void drawBar( QPainter *, int sampleIndex,
108 int valueIndex, const QwtColumnRect & ) const;
109
110 void drawStackedBars( QPainter *painter,
111 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
112 const QRectF &canvasRect, int index,
113 double sampleWidth, const QwtSetSample& sample ) const;
114
115 void drawGroupedBars( QPainter *painter,
116 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
117 const QRectF &canvasRect, int index,
118 double sampleWidth, const QwtSetSample& sample ) const;
119
120private:
121 void init();
122
123 class PrivateData;
124 PrivateData *d_data;
125};
126
127#endif
Note: See TracBrowser for help on using the repository browser.