QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Calculator for a numeric histogram from a list of values. More...
#include <qgshistogram.h>
Public Member Functions | |
QgsHistogram () | |
virtual | ~QgsHistogram () |
QList< double > | binEdges (int bins) const |
Returns a list of edges for the histogram for a specified number of bins. More... | |
QList< int > | counts (int bins) const |
Returns the calculated list of the counts for the histogram bins. More... | |
double | optimalBinWidth () const |
Calculates the optimal bin width using the Freedman-Diaconis rule. More... | |
int | optimalNumberBins () const |
Returns the optimal number of bins for the source values, calculated using the Freedman-Diaconis rule. More... | |
void | setValues (const QList< double > &values) |
Assigns numeric source values for the histogram. More... | |
bool | setValues (QgsVectorLayer *layer, const QString &fieldOrExpression) |
Assigns numeric source values for the histogram from a vector layer's field or as the result of an expression. More... | |
Calculator for a numeric histogram from a list of values.
Definition at line 33 of file qgshistogram.h.
QgsHistogram::QgsHistogram | ( | ) |
Definition at line 24 of file qgshistogram.cpp.
|
virtual |
Definition at line 32 of file qgshistogram.cpp.
QList< double > QgsHistogram::binEdges | ( | int | bins | ) | const |
Returns a list of edges for the histogram for a specified number of bins.
This list will be length bins + 1, as both the first and last value are also included.
bins | number of bins |
Definition at line 81 of file qgshistogram.cpp.
QList< int > QgsHistogram::counts | ( | int | bins | ) | const |
Returns the calculated list of the counts for the histogram bins.
bins | number of histogram bins |
Definition at line 97 of file qgshistogram.cpp.
double QgsHistogram::optimalBinWidth | ( | ) | const |
Calculates the optimal bin width using the Freedman-Diaconis rule.
Bins widths are determined by the inter-quartile range of values and the number of values.
Definition at line 70 of file qgshistogram.cpp.
int QgsHistogram::optimalNumberBins | ( | ) | const |
Returns the optimal number of bins for the source values, calculated using the Freedman-Diaconis rule.
The number of bins are determined by the inter-quartile range of values and the number of values.
Definition at line 76 of file qgshistogram.cpp.
void QgsHistogram::setValues | ( | const QList< double > & | values | ) |
Assigns numeric source values for the histogram.
values | list of doubles |
Definition at line 49 of file qgshistogram.cpp.
bool QgsHistogram::setValues | ( | QgsVectorLayer * | layer, |
const QString & | fieldOrExpression | ||
) |
Assigns numeric source values for the histogram from a vector layer's field or as the result of an expression.
layer | vector layer |
fieldOrExpression | field name or expression to be evaluated |
Definition at line 55 of file qgshistogram.cpp.