QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
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
40 QgsHistogram() = default;
41
42 virtual ~QgsHistogram() = default;
43
48 void setValues( const QList<double> &values );
49
58 bool setValues( const QgsVectorLayer *layer, const QString &fieldOrExpression, QgsFeedback *feedback = nullptr );
59
67 double optimalBinWidth() const;
68
77 int optimalNumberBins() const;
78
86 QList<double> binEdges( int bins ) const;
87
94 QList<int> counts( int bins ) const;
95
96 private:
97
98 QList<double> mValues;
99 double mMax = 0;
100 double mMin = 0;
101 double mIQR = 0;
102
103 void prepareValues();
104
105};
106
107#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.
QgsHistogram()=default
virtual ~QgsHistogram()=default
Represents a vector layer which manages a vector based data sets.