27 return QObject::tr(
"Equal Count (Quantile)" );
32 return QStringLiteral(
"Quantile" );
48 QList<double> QgsClassificationQuantile::calculateBreaks(
double &minimum,
double &maximum,
49 const QList<double> &values,
int nclasses )
63 QList<double> _values = values;
64 std::sort( _values.begin(), _values.end() );
69 if ( _values.isEmpty() )
70 return QList<double>();
72 int n = _values.count();
73 double Xq = n > 0 ? _values[0] : 0.0;
75 breaks.reserve( nclasses );
76 for (
int i = 1; i < nclasses; i++ )
80 double q = i /
static_cast< double >( nclasses );
81 double a = q * ( n - 1 );
82 int aa =
static_cast< int >( a );
85 Xq = ( 1 - r ) * _values[aa] + r * _values[aa + 1];
90 breaks.append( _values[ n - 1 ] );