QGIS API Documentation
3.4.15-Madeira (e83d02e274)
|
Calculator for a numeric histogram from a list of values. More...
#include <qgshistogram.h>
Public Member Functions | |
QgsHistogram ()=default | |
Constructor for QgsHistogram. More... | |
virtual | ~QgsHistogram ()=default |
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 (const QgsVectorLayer *layer, const QString &fieldOrExpression, QgsFeedback *feedback=nullptr) |
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 37 of file qgshistogram.h.
|
default |
Constructor for QgsHistogram.
|
virtualdefault |
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 68 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 84 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 57 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 63 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 36 of file qgshistogram.cpp.
bool QgsHistogram::setValues | ( | const QgsVectorLayer * | layer, |
const QString & | fieldOrExpression, | ||
QgsFeedback * | feedback = nullptr |
||
) |
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 |
feedback | optional feedback object to allow cancellation of calculation |
Definition at line 42 of file qgshistogram.cpp.