QWT 7.0.1
Loading...
Searching...
No Matches
qwt_plot_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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PLOT_BAR_CHART_H
28#define QWT_PLOT_BAR_CHART_H
29
30#include "qwt_global.h"
31#include "qwt_plot_abstract_barchart.h"
32#include "qwt_column_symbol.h"
33
34class QwtColumnRect;
35template< typename T >
36class QwtSeriesData;
37
59class QWT_EXPORT QwtPlotBarChart : public QwtPlotAbstractBarChart, public QwtSeriesStore< QPointF >
60{
61public:
69 {
77
84 LegendBarTitles
85 };
86
87 explicit QwtPlotBarChart(const QString& title = QString());
88 explicit QwtPlotBarChart(const QwtText& title);
89
90 virtual ~QwtPlotBarChart();
91
92 virtual int rtti() const QWT_OVERRIDE;
93
94 void setSamples(const QVector< QPointF >&);
95 void setSamples(const QVector< double >&);
96 void setSamples(QwtSeriesData< QPointF >*);
97
98 void setSymbol(QwtColumnSymbol*);
99 const QwtColumnSymbol* symbol() const;
100
101 void setPen(const QPen& p);
102 QPen pen() const;
103
104 void setBrush(const QBrush& b);
105 QBrush brush() const;
106
107 void setFrameStyle(QwtColumnSymbol::FrameStyle f);
108 QwtColumnSymbol::FrameStyle frameStyle() const;
109
110 void setLegendMode(LegendMode);
111 LegendMode legendMode() const;
112
113 virtual void drawSeries(QPainter*,
114 const QwtScaleMap& xMap,
115 const QwtScaleMap& yMap,
116 const QRectF& canvasRect,
117 int from,
118 int to) const QWT_OVERRIDE;
119
120 virtual QRectF boundingRect() const QWT_OVERRIDE;
121
122 virtual QwtColumnSymbol* specialSymbol(int sampleIndex, const QPointF&) const;
123
124 virtual QwtText barTitle(int sampleIndex) const;
125
126protected:
127 virtual void drawSample(QPainter* painter,
128 const QwtScaleMap& xMap,
129 const QwtScaleMap& yMap,
130 const QRectF& canvasRect,
131 const QwtInterval& boundingInterval,
132 int index,
133 const QPointF& sample) const;
134
135 virtual void drawBar(QPainter*, int sampleIndex, const QPointF& sample, const QwtColumnRect&) const;
136
137 QwtColumnRect columnRect(const QwtScaleMap& xMap,
138 const QwtScaleMap& yMap,
139 const QRectF& canvasRect,
140 const QwtInterval& boundingInterval,
141 const QPointF& sample) const;
142
143 QList< QwtLegendData > legendData() const QWT_OVERRIDE;
144 QwtGraphic legendIcon(int index, const QSizeF&) const QWT_OVERRIDE;
145
146private:
147 void init();
148
149 class PrivateData;
150 PrivateData* m_data;
151};
152
153#endif
Definition qwt_dyngrid_layout.h:33
Definition qwt_clipper.h:40
Directed rectangle representing bounding rectangle and orientation of a column.
Definition qwt_column_symbol.h:44
A drawing primitive for columns.
Definition qwt_column_symbol.h:91
A paint device for scalable graphics.
Definition qwt_graphic.h:93
A class representing an interval.
Definition qwt_interval.h:40
Attributes of an entry on a legend.
Definition qwt_legend_data.h:54
Abstract base class for bar chart items.
Definition qwt_plot_abstract_barchart.h:42
QwtPlotBarChart displays a series of a values as bars.
Definition qwt_plot_barchart.h:60
LegendMode
Legend modes.
Definition qwt_plot_barchart.h:69
@ LegendChartTitle
One entry on the legend showing the default symbol and the title() of the chart.
Definition qwt_plot_barchart.h:76
virtual int rtti() const
Return rtti for the specific class represented.
Definition qwt_plot_item.cpp:153
A scale map.
Definition qwt_scale_map.h:44
Abstract interface for iterating over samples.
Definition qwt_series_data.h:67
Class storing a QwtSeriesData object.
Definition qwt_series_store.h:96
A class representing a text.
Definition qwt_text.h:69