37 void QgsHistogram::prepareValues()
39 qSort( mValues.
begin(), mValues.
end() );
43 s.calculate( mValues );
46 mIQR = s.interQuartileRange();
73 return 2.0 * mIQR * qPow( mValues.
count(), -1 / 3.0 );
83 double binWidth = ( mMax - mMin ) / bins;
88 double current = mMin;
89 for (
int i = 0; i < bins; ++i )
103 int currentValueIndex = 0;
104 for (
int i = 0; i < bins; ++i )
107 while ( currentValueIndex < mValues.
count() && mValues.
at( currentValueIndex ) < edges.
at( i + 1 ) )
111 if ( currentValueIndex >= mValues.
count() )
117 if ( currentValueIndex < mValues.
count() )
120 binCounts[ bins - 1 ] = binCounts.
last() + 1;
QList< double > binEdges(int bins) const
Returns a list of edges for the histogram for a specified number of bins.
const T & at(int i) const
QList< double > getDoubleValues(const QString &fieldOrExpression, bool &ok, bool selectedOnly=false, int *nullCount=nullptr)
Fetches all double values from a specified field name or expression.
void setStatistics(const Statistics &stats)
Sets flags which specify which statistics will be calculated.
int count(const T &value) const
Inter quartile range (IQR)
void setValues(const QList< double > &values)
Assigns numeric source values for the histogram.
QList< int > counts(int bins) const
Returns the calculated list of the counts for the histogram bins.
Calculator for summary statistics for a list of doubles.
Represents a vector layer which manages a vector based data sets.
int optimalNumberBins() const
Returns the optimal number of bins for the source values, calculated using the Freedman-Diaconis rule...
double optimalBinWidth() const
Calculates the optimal bin width using the Freedman-Diaconis rule.