QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgshistogram.h
Go to the documentation of this file.
1/***************************************************************************
2 qgshistogram.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
18#ifndef QGSHISTOGRAM_H
19#define QGSHISTOGRAM_H
20
21#include <QList>
22
23#include "qgis_core.h"
24#include "qgsfeedback.h"
25
26class QgsVectorLayer;
27
28
36class CORE_EXPORT QgsHistogram
37{
38 public:
39
43 QgsHistogram() = default;
44
45 virtual ~QgsHistogram() = default;
46
51 void setValues( const QList<double> &values );
52
61 bool setValues( const QgsVectorLayer *layer, const QString &fieldOrExpression, QgsFeedback *feedback = nullptr );
62
70 double optimalBinWidth() const;
71
80 int optimalNumberBins() const;
81
89 QList<double> binEdges( int bins ) const;
90
97 QList<int> counts( int bins ) const;
98
99 private:
100
101 QList<double> mValues;
102 double mMax = 0;
103 double mMin = 0;
104 double mIQR = 0;
105
106 void prepareValues();
107
108};
109
110#endif // QGSHISTOGRAM_H
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44
Calculator for a numeric histogram from a list of values.
Definition: qgshistogram.h:37
QgsHistogram()=default
Constructor for QgsHistogram.
virtual ~QgsHistogram()=default
Represents a vector layer which manages a vector based data sets.