Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
qwt_plot_multi_barchart.h
1/******************************************************************************
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
16 class QwtColumnRect;
17 class QwtColumnSymbol;
18 template< typename T > class QwtSeriesData;
19
41 class QWT_EXPORT QwtPlotMultiBarChart
42 : public QwtPlotAbstractBarChart
43 , public QwtSeriesStore< QwtSetSample >
44{
45 public:
52 enum ChartStyle
53 {
55 Grouped,
56
62 Stacked
63 };
64
65 explicit QwtPlotMultiBarChart( const QString& title = QString() );
66 explicit QwtPlotMultiBarChart( const QwtText& title );
67
68 virtual ~QwtPlotMultiBarChart();
69
70 virtual int rtti() const QWT_OVERRIDE;
71
72 void setBarTitles( const QList< QwtText >& );
73 QList< QwtText > barTitles() const;
74
75 void setSamples( const QVector< QwtSetSample >& );
76 void setSamples( const QVector< QVector< double > >& );
77 void setSamples( QwtSeriesData< QwtSetSample >* );
78
79 void setStyle( ChartStyle style );
80 ChartStyle style() const;
81
82 void setSymbol( int valueIndex, QwtColumnSymbol* );
83 const QwtColumnSymbol* symbol( int valueIndex ) const;
84
85 void resetSymbolMap();
86
87 virtual void drawSeries( QPainter*,
88 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
89 const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
90
91 virtual QRectF boundingRect() const QWT_OVERRIDE;
92
93 virtual QList< QwtLegendData > legendData() const QWT_OVERRIDE;
94
95 virtual QwtGraphic legendIcon(
96 int index, const QSizeF& ) const QWT_OVERRIDE;
97
98 protected:
99 QwtColumnSymbol* symbol( int valueIndex );
100
101 virtual QwtColumnSymbol* specialSymbol(
102 int sampleIndex, int valueIndex ) const;
103
104 virtual void drawSample( QPainter*,
105 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
106 const QRectF& canvasRect, const QwtInterval& boundingInterval,
107 int index, const QwtSetSample& ) const;
108
109 virtual void drawBar( QPainter*, int sampleIndex,
110 int valueIndex, const QwtColumnRect& ) const;
111
112 void drawStackedBars( QPainter*,
113 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
114 const QRectF& canvasRect, int index,
115 double sampleWidth, const QwtSetSample& ) const;
116
117 void drawGroupedBars( QPainter*,
118 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
119 const QRectF& canvasRect, int index,
120 double sampleWidth, const QwtSetSample& ) const;
121
122 private:
123 void init();
124
125 class PrivateData;
126 PrivateData* m_data;
127};
128
129#endif
QList
Definition qwt_abstract_legend.h:17
QVector
Definition qwt_clipper.h:23
QwtColumnRect
Directed rectangle representing bounding rectangle and orientation of a column.
Definition qwt_column_symbol.h:27
QwtColumnSymbol
A drawing primitive for columns.
Definition qwt_column_symbol.h:75
QwtGraphic
A paint device for scalable graphics.
Definition qwt_graphic.h:76
QwtInterval
A class representing an interval.
Definition qwt_interval.h:23
QwtLegendData
Attributes of an entry on a legend.
Definition qwt_legend_data.h:37
QwtPlotAbstractBarChart
Abstract base class for bar chart items.
Definition qwt_plot_abstract_barchart.h:25
QwtPlotItem::rtti
virtual int rtti() const
Definition qwt_plot_item.cpp:136
QwtPlotMultiBarChart
QwtPlotMultiBarChart displays a series of a samples that consist each of a set of values.
Definition qwt_plot_multi_barchart.h:44
QwtPlotMultiBarChart::ChartStyle
ChartStyle
Chart styles.
Definition qwt_plot_multi_barchart.h:53
QwtPlotMultiBarChart::Grouped
@ Grouped
The bars of a set are displayed side by side.
Definition qwt_plot_multi_barchart.h:55
QwtScaleMap
A scale map.
Definition qwt_scale_map.h:27
QwtSeriesData
Abstract interface for iterating over samples.
Definition qwt_series_data.h:50
QwtSeriesStore
Class storing a QwtSeriesData object.
Definition qwt_series_store.h:67
QwtSetSample
A sample of the types (x1...xn, y) or (x, y1..yn)
Definition qwt_samples.h:74
QwtText
A class representing a text.
Definition qwt_text.h:52