QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgshistogramwidget.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgshistogramwidget.h
3
--------------------
4
begin : May 2015
5
copyright : (C) 2015 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
#ifndef QGSHISTOGRAMWIDGET_H
18
#define QGSHISTOGRAMWIDGET_H
19
20
#include "ui_qgshistogramwidgetbase.h"
21
22
#include "qgis_gui.h"
23
#include "
qgis_sip.h
"
24
#include "
qgsgraduatedsymbolrenderer.h
"
25
#include "
qgshistogram.h
"
26
#include "
qgsstatisticalsummary.h
"
27
28
#include <QBrush>
29
#include <QPen>
30
31
class
QgsSettingsEntryBool
;
32
class
QgsVectorLayer
;
33
class
QgsGraduatedSymbolRenderer
;
34
class
QwtPlotPicker;
35
class
QwtPlotMarker;
36
class
QwtPlot;
37
class
HistogramItem;
38
class
QwtPlotHistogram;
39
40
// fix for qwt5/qwt6 QwtDoublePoint vs. QPointF
41
typedef
QPointF
QwtDoublePoint
;
42
49
50
class
GUI_EXPORT
QgsHistogramWidget
:
public
QWidget,
private
Ui::QgsHistogramWidgetBase
51
{
52
Q_OBJECT
53
54
public
:
62
QgsHistogramWidget
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
,
QgsVectorLayer
*
layer
=
nullptr
,
const
QString &fieldOrExp = QString() );
63
64
~QgsHistogramWidget
()
override
;
65
66
static
const
QgsSettingsEntryBool
*
settingsHistogramShowMean
SIP_SKIP
;
67
static
const
QgsSettingsEntryBool
*
settingsHistogramShowStdev
SIP_SKIP
;
68
74
QgsVectorLayer
*
layer
() {
return
mVectorLayer; }
75
82
QString
sourceFieldExp
()
const
{
return
mSourceFieldExp; }
83
92
void
setPen
(
const
QPen &
pen
) { mPen =
pen
; }
93
99
QPen
pen
()
const
{
return
mPen; }
100
108
void
setBrush
(
const
QBrush &
brush
) { mBrush =
brush
; }
109
115
QBrush
brush
()
const
{
return
mBrush; }
116
123
void
setGraduatedRanges(
const
QgsRangeList
&ranges );
124
131
QgsRangeList
graduatedRanges
()
const
{
return
mRanges
; }
132
138
QString
xAxisTitle
()
const
{
return
mXAxisTitle; }
139
146
void
setXAxisTitle
(
const
QString &title ) { mXAxisTitle = title; }
147
153
QString
yAxisTitle
()
const
{
return
mYAxisTitle; }
154
161
void
setYAxisTitle
(
const
QString &title ) { mYAxisTitle = title; }
162
163
public
slots:
164
168
void
refreshValues();
169
174
void
refresh();
175
181
void
setLayer(
QgsVectorLayer
*layer );
182
188
void
setSourceFieldExp(
const
QString &fieldOrExp );
189
190
protected
:
194
virtual
void
drawHistogram();
195
196
QwtPlot *
mPlot
=
nullptr
;
197
QgsRangeList
mRanges
;
198
QList<QwtPlotMarker *>
mRangeMarkers
;
199
200
private
:
201
QgsVectorLayer
*mVectorLayer =
nullptr
;
202
QString mSourceFieldExp;
203
QList<double> mValues;
204
QgsStatisticalSummary
mStats;
205
QgsHistogram
mHistogram;
206
QVector<QColor> mHistoColors;
207
QPen mPen;
208
QBrush mBrush;
209
QPen mMeanPen;
210
QPen mStdevPen;
211
QPen mGridPen;
212
QString mXAxisTitle;
213
QString mYAxisTitle;
214
215
void
clearHistogram();
216
217
QwtPlotHistogram *createPlotHistogram(
const
QString &title,
const
QBrush &
brush
,
const
QPen &
pen
= Qt::NoPen )
const
;
218
};
219
220
#endif
//QGSHISTOGRAMWIDGET_H
QgsGraduatedSymbolRenderer
A vector feature renderer which uses numeric attributes to classify features into different ranges.
Definition
qgsgraduatedsymbolrenderer.h:37
QgsHistogramWidget::mRangeMarkers
QList< QwtPlotMarker * > mRangeMarkers
Definition
qgshistogramwidget.h:198
QgsHistogramWidget::settingsHistogramShowStdev
static const QgsSettingsEntryBool * settingsHistogramShowStdev
Definition
qgshistogramwidget.h:67
QgsHistogramWidget::xAxisTitle
QString xAxisTitle() const
Returns the title for the histogram's x-axis.
Definition
qgshistogramwidget.h:138
QgsHistogramWidget::graduatedRanges
QgsRangeList graduatedRanges() const
Returns the graduated ranges associated with the histogram.
Definition
qgshistogramwidget.h:131
QgsHistogramWidget::pen
QPen pen() const
Returns the pen used when drawing histogram bars.
Definition
qgshistogramwidget.h:99
QgsHistogramWidget::setYAxisTitle
void setYAxisTitle(const QString &title)
Sets the title for the histogram's y-axis.
Definition
qgshistogramwidget.h:161
QgsHistogramWidget::mPlot
QwtPlot * mPlot
Definition
qgshistogramwidget.h:196
QgsHistogramWidget::settingsHistogramShowMean
static const QgsSettingsEntryBool * settingsHistogramShowMean
Definition
qgshistogramwidget.h:66
QgsHistogramWidget::QgsHistogramWidget
QgsHistogramWidget(QWidget *parent=nullptr, QgsVectorLayer *layer=nullptr, const QString &fieldOrExp=QString())
QgsHistogramWidget constructor.
Definition
qgshistogramwidget.cpp:53
QgsHistogramWidget::setPen
void setPen(const QPen &pen)
Sets the pen to use when drawing histogram bars.
Definition
qgshistogramwidget.h:92
QgsHistogramWidget::sourceFieldExp
QString sourceFieldExp() const
Returns the source field name or expression used to calculate values displayed in the histogram.
Definition
qgshistogramwidget.h:82
QgsHistogramWidget::setXAxisTitle
void setXAxisTitle(const QString &title)
Sets the title for the histogram's x-axis.
Definition
qgshistogramwidget.h:146
QgsHistogramWidget::mRanges
QgsRangeList mRanges
Definition
qgshistogramwidget.h:197
QgsHistogramWidget::setBrush
void setBrush(const QBrush &brush)
Sets the brush used for drawing histogram bars.
Definition
qgshistogramwidget.h:108
QgsHistogramWidget::brush
QBrush brush() const
Returns the brush used when drawing histogram bars.
Definition
qgshistogramwidget.h:115
QgsHistogramWidget::layer
QgsVectorLayer * layer()
Returns the layer currently associated with the widget.
Definition
qgshistogramwidget.h:74
QgsHistogramWidget::yAxisTitle
QString yAxisTitle() const
Returns the title for the histogram's y-axis.
Definition
qgshistogramwidget.h:153
QgsHistogram
Calculator for a numeric histogram from a list of values.
Definition
qgshistogram.h:37
QgsSettingsEntryBool
A boolean settings entry.
Definition
qgssettingsentryimpl.h:298
QgsStatisticalSummary
Calculator for summary statistics for a list of doubles.
Definition
qgsstatisticalsummary.h:47
QgsVectorLayer
Represents a vector layer which manages a vector based dataset.
Definition
qgsvectorlayer.h:414
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
QwtDoublePoint
QPointF QwtDoublePoint
Definition
qgscurveeditorwidget.h:40
qgsgraduatedsymbolrenderer.h
qgshistogram.h
QgsRangeList
QList< QgsRendererRange > QgsRangeList
Definition
qgsrendererrange.h:223
qgsstatisticalsummary.h
Generated on
for QGIS API Documentation by
1.17.0