16#ifndef QGSSTATISTICALSUMMARY_H
17#define QGSSTATISTICALSUMMARY_H
51 CountMissing = 1 << 15,
63 FirstQuartile = 1 << 12,
64 ThirdQuartile = 1 << 13,
65 InterQuartileRange = 1 << 14,
68 All = Count | CountMissing | Sum | Mean | Median | StDev | Max | Min | Range | Minority | Majority | Variety | FirstQuartile | ThirdQuartile | InterQuartileRange | First | Last
70 Q_DECLARE_FLAGS( Statistics, Statistic )
93 void setStatistics( QgsStatisticalSummary::Statistics stats );
104 void calculate(
const QList<double> &values );
121 void addValue(
double value );
138 void addVariant(
const QVariant &value );
160 int count()
const {
return mCount; }
171 double sum()
const {
return mSum; }
177 double mean()
const {
return mMean; }
184 double median()
const {
return mMedian; }
190 double min()
const {
return mMin; }
196 double max()
const {
return mMax; }
202 double range()
const {
return std::isnan( mMax ) || std::isnan( mMin ) ? std::numeric_limits<double>::quiet_NaN() : mMax - mMin; }
210 double first()
const {
return mFirst; }
218 double last()
const {
return mLast; }
226 double stDev()
const {
return mStdev; }
241 int variety()
const {
return mValueCount.count(); }
286 double interQuartileRange()
const {
return std::isnan( mThirdQuartile ) || std::isnan( mFirstQuartile ) ? std::numeric_limits<double>::quiet_NaN() : mThirdQuartile - mFirstQuartile; }
303 Statistics mStatistics;
316 double mFirstQuartile;
317 double mThirdQuartile;
320 QMap< double, int > mValueCount;
321 QList< double > mValues;
322 bool mRequiresAllValueStorage =
false;
323 bool mRequiresHisto =
false;
Calculator for summary statistics for a list of doubles.
double firstQuartile() const
Returns the first quartile of the values.
Statistic
Enumeration of flags that specify statistics to be calculated.
double sum() const
Returns calculated sum of values.
double mean() const
Returns calculated mean of values.
double last() const
Returns the last value obtained.
double majority() const
Returns majority of values.
int countMissing() const
Returns the number of missing (null) values.
Statistics statistics() const
Returns flags which specify which statistics will be calculated.
double interQuartileRange() const
Returns the inter quartile range of the values.
double median() const
Returns calculated median of values.
double minority() const
Returns minority of values.
double sampleStDev() const
Returns sample standard deviation.
double min() const
Returns calculated minimum from values.
virtual ~QgsStatisticalSummary()=default
double first() const
Returns the first value obtained.
double stDev() const
Returns population standard deviation.
double thirdQuartile() const
Returns the third quartile of the values.
int count() const
Returns calculated count of values.
double range() const
Returns calculated range (difference between maximum and minimum values).
double max() const
Returns calculated maximum from values.
int variety() const
Returns variety of values.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)