Skip to content

Commit d1cd6db

Browse files
committed
area accuracy for circular diagrams
1 parent 07839fa commit d1cd6db

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/core/qgsdiagram.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ QSizeF QgsTextDiagram::diagramSize( const QgsAttributeMap& attributes, const Qgs
9393

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

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

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

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

0 commit comments

Comments
 (0)