Skip to content
Permalink
Browse files

Calculate size for PAL correctly also if same attribute is used multi…

…ple times.
  • Loading branch information
m-kuhn committed Sep 3, 2012
1 parent 25f0f1f commit 9c4d67c241b284aa5a67eda18547f8a465e22bc1
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/core/diagram/qgshistogramdiagram.cpp
@@ -72,6 +72,7 @@ QSizeF QgsHistogramDiagram::diagramSize( const QgsAttributeMap& attributes, cons

QSizeF QgsHistogramDiagram::diagramSize( const QgsAttributeMap& attributes, const QgsRenderContext& c, const QgsDiagramSettings& s )
{
Q_UNUSED( c );
QSizeF size;

QgsAttributeMap::const_iterator attIt = attributes.constBegin();
@@ -92,14 +93,14 @@ QSizeF QgsHistogramDiagram::diagramSize( const QgsAttributeMap& attributes, cons
case QgsDiagramSettings::Up:
case QgsDiagramSettings::Down:
mScaleFactor = maxValue / s.size.height();
size.scale( s.barWidth * attributes.size(), s.size.height(), Qt::IgnoreAspectRatio );
size.scale( s.barWidth * s.categoryColors.size(), s.size.height(), Qt::IgnoreAspectRatio );
break;

case QgsDiagramSettings::Right:
case QgsDiagramSettings::Left:
default: // just in case...
mScaleFactor = maxValue / s.size.width();
size.scale( s.size.width(), s.barWidth * attributes.size(), Qt::IgnoreAspectRatio );
size.scale( s.size.width(), s.barWidth * s.categoryColors.size(), Qt::IgnoreAspectRatio );
break;
}

0 comments on commit 9c4d67c

Please sign in to comment.
You can’t perform that action at this time.