25 mCategoryBrush.setStyle( Qt::SolidPattern );
26 mPen.setStyle( Qt::SolidLine );
48 attrVal = expression->
evaluate( &expressionContext );
56 double value = attrVal.toDouble( &ok );
67 double painterUnitConversionScale =
c.convertToPainterUnits( 1, s.
sizeType );
70 mApplySpacingAdjust =
true;
77 const double totalBarLength = size.height() + spacing * std::max( 0, s.
categoryAttributes.size() - 1 );
78 size = QSizeF( s.
barWidth, totalBarLength );
85 const double totalBarLength = size.width() + spacing * std::max( 0, s.
categoryAttributes.size() - 1 );
86 size = QSizeF( totalBarLength, s.
barWidth );
106 return value * scaleFactor;
119 if ( attributes.isEmpty() )
125 for (
int i = 0; i < attributes.count(); ++i )
127 totalSum += attributes.at( i ).toDouble();
133 double painterUnitConversionScale =
c.convertToPainterUnits( 1, s.
sizeType );
155 QPainter *p =
c.painter();
161 QList<double> values;
173 double currentVal = expression->
evaluate( &expressionContext ).toDouble();
174 values.push_back( currentVal );
181 double scaledMaxVal = 0;
194 if ( mApplySpacingAdjust )
195 scaledMaxVal -= totalSpacing;
197 double currentOffset = 0;
201 double baseX = position.x();
202 double baseY = position.y();
208 QList<double>::const_iterator valIt = values.constBegin();
209 QList< QColor >::const_iterator colIt = s.
categoryColors.constBegin();
210 for ( ; valIt != values.constEnd(); ++valIt, ++colIt )
212 double length = *valIt / total * scaledMaxVal;
214 mCategoryBrush.setColor( *colIt );
215 p->setBrush( mCategoryBrush );
220 p->drawRect( QRectF( baseX, baseY - currentOffset, scaledWidth, length * -1 ) );
224 p->drawRect( QRectF( baseX, baseY + currentOffset - scaledMaxVal - spacing * std::max( 0, values.size() - 1 ), scaledWidth, length ) );
228 p->drawRect( QRectF( baseX + currentOffset, baseY - scaledWidth, length, scaledWidth ) );
232 p->drawRect( QRectF( baseX + scaledMaxVal - currentOffset + spacing * std::max( 0, values.size() - 1 ), baseY - scaledWidth, 0 - length, scaledWidth ) );
236 currentOffset += length + spacing;