QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
Calculator for a numeric histogram from a list of values. More...
#include <qgshistogram.h>
Public Member Functions | |
QgsHistogram ()=default | |
virtual | ~QgsHistogram ()=default |
QList< double > | binEdges (int bins) const |
Returns a list of edges for the histogram for a specified number of bins. | |
QList< int > | counts (int bins) const |
Returns the calculated list of the counts for the histogram bins. | |
double | optimalBinWidth () const |
Calculates the optimal bin width using the Freedman-Diaconis rule. | |
int | optimalNumberBins () const |
Returns the optimal number of bins for the source values, calculated using the Freedman-Diaconis rule. | |
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. | |
void | setValues (const QList< double > &values) |
Assigns numeric source values for the histogram. | |
Calculator for a numeric histogram from a list of values.
Definition at line 36 of file qgshistogram.h.
|
default |
|
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.
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 |
true
if values were successfully set Definition at line 42 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.