Skip to content
Permalink
Browse files

[diagrams] Diagram fixes and UI improvements (Fix #7960)

  * Use correct color for pie chart if only one value is >0
  * Show default text in scaling text box
  • Loading branch information
m-kuhn committed Jun 7, 2013
1 parent eda9cd3 commit 8c840e99574ec3ce2cce45a0bc51bc87d88e3b8a
Showing with 17 additions and 11 deletions.
  1. +14 −11 src/core/diagram/qgspiediagram.cpp
  2. +3 −0 src/ui/qgsdiagrampropertiesbase.ui
@@ -128,19 +128,22 @@ void QgsPieDiagram::renderDiagram( const QgsAttributes& att, QgsRenderContext& c
QList< QColor >::const_iterator colIt = s.categoryColors.constBegin();
for ( ; valIt != values.constEnd(); ++valIt, ++colIt )
{
currentAngle = *valIt / valSum * 360 * 16;
mCategoryBrush.setColor( *colIt );
p->setBrush( mCategoryBrush );
// if only 1 value is > 0, draw a circle
if ( valCount == 1 )
if ( *valIt )
{
p->drawEllipse( baseX, baseY, w, h );
currentAngle = *valIt / valSum * 360 * 16;
mCategoryBrush.setColor( *colIt );
p->setBrush( mCategoryBrush );
// if only 1 value is > 0, draw a circle
if ( valCount == 1 )
{
p->drawEllipse( baseX, baseY, w, h );
}
else
{
p->drawPie( baseX, baseY, w, h, totalAngle + s.angleOffset, currentAngle );
}
totalAngle += currentAngle;
}
else
{
p->drawPie( baseX, baseY, w, h, totalAngle + s.angleOffset, currentAngle );
}
totalAngle += currentAngle;
}
}
else // valSum > 0
@@ -431,6 +431,9 @@
<string>The attribute value you enter here will correspond to the size entered in the field &quot;Size&quot; and the chosen &quot;Size unit&quot;.
Leave empty to automatically apply the maximum value.</string>
</property>
<property name="placeholderText">
<string>Empty: Use maximum value</string>
</property>
</widget>
</item>
</layout>

0 comments on commit 8c840e9

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