Skip to content
Permalink
Browse files

area accuracy for circular diagrams

  • Loading branch information
m-kuhn committed Aug 9, 2012
1 parent 07839fa commit d1cd6dbe7bab81cd05ea6147f1d64e919b0fb367
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/core/qgsdiagram.cpp
@@ -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 )
@@ -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 )

0 comments on commit d1cd6db

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