QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 class QgsVectorLayer;
24 
25 
33 class CORE_EXPORT QgsHistogram
34 {
35  public:
36 
37  QgsHistogram();
38 
39  virtual ~QgsHistogram();
40 
44  void setValues( const QList<double>& values );
45 
52  bool setValues( QgsVectorLayer* layer, const QString& fieldOrExpression );
53 
60  double optimalBinWidth() const;
61 
69  int optimalNumberBins() const;
70 
77  QList<double> binEdges( int bins ) const;
78 
84  QList<int> counts( int bins ) const;
85 
86  private:
87 
88  QList<double> mValues;
89  double mMax;
90  double mMin;
91  double mIQR;
92 
93  void prepareValues();
94 
95 };
96 
97 #endif // QGSHISTOGRAM_H
Calculator for a numeric histogram from a list of values.
Definition: qgshistogram.h:33
Represents a vector layer which manages a vector based data sets.