Skip to content

Commit

Permalink
area accuracy for circular diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 9, 2012
1 parent 07839fa commit d1cd6db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/qgsdiagram.cpp
Expand Up @@ -93,8 +93,8 @@ QSizeF QgsTextDiagram::diagramSize( const QgsAttributeMap& attributes, const Qgs

//interpolate size
double ratio = ( value - is.lowerValue ) / ( is.upperValue - is.lowerValue );
QSizeF size = QSizeF( is.upperSize.width() * ratio + is.lowerSize.width() * ( 1 - ratio ),
is.upperSize.height() * ratio + is.lowerSize.height() * ( 1 - ratio ) );
QSizeF size = QSizeF( sqrt( is.upperSize.width() * ratio + is.lowerSize.width() * ( 1 - ratio ) ),
sqrt( is.upperSize.height() * ratio + is.lowerSize.height() * ( 1 - ratio ) ) );

// Scale, if extension is smaller than the specified minimum
if ( size.width() <= s.minimumSize && size.height() <= s.minimumSize )
Expand Down Expand Up @@ -314,8 +314,8 @@ QSizeF QgsPieDiagram::diagramSize( const QgsAttributeMap& attributes, const QgsR

//interpolate size
double ratio = ( value - is.lowerValue ) / ( is.upperValue - is.lowerValue );
QSizeF size = QSizeF( is.upperSize.width() * ratio + is.lowerSize.width() * ( 1 - ratio ),
is.upperSize.height() * ratio + is.lowerSize.height() * ( 1 - ratio ) );
QSizeF size = QSizeF( sqrt( is.upperSize.width() * ratio + is.lowerSize.width() * ( 1 - ratio ) ),
sqrt( is.upperSize.height() * ratio + is.lowerSize.height() * ( 1 - ratio ) ) );

// Scale, if extension is smaller than the specified minimum
if ( size.width() <= s.minimumSize && size.height() <= s.minimumSize )
Expand Down

0 comments on commit d1cd6db

Please sign in to comment.