Skip to content

Commit

Permalink
do not limit the number of classes in logarithmic method
Browse files Browse the repository at this point in the history
this was preventing from setting enough classes
  • Loading branch information
3nids committed Dec 4, 2019
1 parent caf8cfa commit 5cf924b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/core/classification/qgsclassificationlogarithmic.cpp
Expand Up @@ -48,17 +48,14 @@ QIcon QgsClassificationLogarithmic::icon() const

QList<double> QgsClassificationLogarithmic::calculateBreaks( double minimum, double maximum, const QList<double> &values, int nclasses )
{
Q_UNUSED( values );
Q_UNUSED( values )

// get the min/max in log10 scale
int lmin = std::floor( std::log10( minimum ) );
int lmax = std::ceil( std::log10( maximum ) );

// do not create too many classes
nclasses = std::min( lmax - lmin + 1, nclasses );
double log_min = std::floor( std::log10( minimum ) );
double log_max = std::ceil( std::log10( maximum ) );

// calculate pretty breaks
QList<double> breaks = QgsSymbolLayerUtils::prettyBreaks( lmin, lmax, nclasses );
QList<double> breaks = QgsSymbolLayerUtils::prettyBreaks( log_min, log_max, nclasses );

// create the value
for ( int i = 0; i < breaks.count(); i++ )
Expand Down

0 comments on commit 5cf924b

Please sign in to comment.