Skip to content

Commit

Permalink
[diagrams] Fix bars drawn outside of registered diagram extent for so…
Browse files Browse the repository at this point in the history
…me orientations

(cherry picked from commit 993d90a)
  • Loading branch information
nyalldawson committed Nov 23, 2019
1 parent e483229 commit 2d88851
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/diagram/qgshistogramdiagram.cpp
Expand Up @@ -151,6 +151,7 @@ void QgsHistogramDiagram::renderDiagram( const QgsFeature &feature, QgsRenderCon
if ( !feature.fields().isEmpty() )
expressionContext.setFields( feature.fields() );

values.reserve( s.categoryAttributes.size() );
for ( const QString &cat : qgis::as_const( s.categoryAttributes ) )
{
QgsExpression *expression = getExpression( cat, expressionContext );
Expand Down Expand Up @@ -191,11 +192,11 @@ void QgsHistogramDiagram::renderDiagram( const QgsFeature &feature, QgsRenderCon
break;

case QgsDiagramSettings::Right:
p->drawRect( baseX, baseY - currentOffset, length, scaledWidth * -1 );
p->drawRect( baseX, baseY - currentOffset, length, scaledWidth );
break;

case QgsDiagramSettings::Left:
p->drawRect( baseX + scaledMaxVal, baseY - currentOffset, 0 - length, scaledWidth * -1 );
p->drawRect( baseX + scaledMaxVal, baseY - currentOffset, 0 - length, scaledWidth );
break;
}

Expand Down

0 comments on commit 2d88851

Please sign in to comment.